acf group

// LOOP

<?php if( have_rows('hero') ): ?>
    <?php while( have_rows('hero') ): the_row(); 

        // Get sub field values.
        $image = get_sub_field('image');
        $link = get_sub_field('link');

        ?>
        <div id="hero">
            <img src="<?php echo esc_url( $image['url'] ); ?>" alt="<?php echo esc_attr( $image['alt'] ); ?>" />
            <div class="content">
                <?php the_sub_field('caption'); ?>
                <a href="<?php echo esc_url( $link['url'] ); ?>"><?php echo esc_attr( $link['title'] ); ?></a>
            </div>
        </div>
        <style type="text/css">
            #hero {
                background-color: <?php the_sub_field('color'); ?>;
            }
        </style>
    <?php endwhile; ?>
<?php endif; ?>

3.56
9
ThatsNinja 95 points

                                    &lt;?php

// BASIC GROUP

$hero = get_field('hero');
if( $hero ): ?&gt;
    &lt;div id=&quot;hero&quot;&gt;
        &lt;img src=&quot;&lt;?php echo esc_url( $hero['image']['url'] ); ?&gt;&quot; alt=&quot;&lt;?php echo esc_attr( $hero['image']['alt'] ); ?&gt;&quot; /&gt;
        &lt;div class=&quot;content&quot;&gt;
            &lt;?php echo $hero['caption']; ?&gt;
            &lt;a href=&quot;&lt;?php echo esc_url( $hero['link']['url'] ); ?&gt;&quot;&gt;&lt;?php echo esc_html( $hero['link']['title'] ); ?&gt;&lt;/a&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;style type=&quot;text/css&quot;&gt;
        #hero {
            background-color: &lt;?php echo esc_attr( $hero['color'] ); ?&gt;;
        }
    &lt;/style&gt;
&lt;?php endif; ?&gt;

3.56 (9 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
acf group for variations how to view acf group field acf group query ACF group options group field acf acf group field tutorial acf display group field acf group field in page acf add group get acf group fields acf option group acf fields group grouping acf group get the field acf options group acf the group field acf get subfield from group acf group get field set acl group acf group get from page Advanced Custom Fields: group Field advanced custom fields group field acf group text get group acf acf get field from field group acf group image acf get sub of sub of group acf get sub of sub group acf use field groups acf layout group advanced custom fields group buy acf call to group acf get value from group get fieldgroup acf acf get fields form group acf get group form field group acf how to use field groups in acf acf get data from group field acf group field data group in acf wordpress acf get field group for page acf group field has value wordpress get field from group acf how to get field group acf prepare group acf field grounp display in page show group field acf acf group sub field acf get field group acf add field to sub group get field inside group acf get a group field advanced custom field display field group acf use field group of other field group acf acf field group field type inwordprss is sub field or field display group feild ACF acf group code acf var dump groups acf get grouo acf get fields frm group get group sub field acf get group fields advanced custom fields get value form group advanced custom fields advanced custom fields group values adnvaced custom fields get field from group acf get group field acf get_field from specific field group acf get_field from other field group wp get field group child get field group child advanced custom fields get group acf get data from another group acf get group Group in group display ACF Display Groups in groups ACF display FIELDS GROUP IN GROUP acf how i get url from group fields get field from group acf acf get group field value get group inside group acf get custom field value group and subgroups in acf demo get custom field value group and subgroups in acf how to get group field in acf acf group field advanced custom fields pro group sub field acf get field from group acf group field value custom field - group php group custom fields wordpress php Display contents group field wordpress how to save group filds value in wordpress programmatically how to save group field value acf in wordpress how to save group filds value acf in wordpress acf group wordpress Wordpress ACF Display from A Field Group acf list fields in group acf get fields in field group acf get group fields acf get sub field from group group acf acf how to get field in group acf group
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source