• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Advanced Custom Fields Repeater

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Advanced Custom Fields Repeater

This topic is: resolved

Tagged: ACF, advanced custom fields, Custom fields, repeater

  • This topic has 4 replies, 2 voices, and was last updated 11 years, 4 months ago by Simon Abramson.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • February 25, 2014 at 11:47 am #92323
    Simon Abramson
    Member

    I'm having trouble displaying info that's stored via ACF's Repeater Add-on.

    ACF suggests using the following, but I'm not sure how to make this play nicely with Genesis.

    <?php
     
    // check if the repeater field has rows of data
    if( have_rows('repeater_field_name') ):
     
     	// loop through the rows of data
        while ( have_rows('repeater_field_name') ) : the_row();
     
            // display a sub field value
            the_sub_field('sub_field_name');
     
        endwhile;
     
    else :
     
        // no rows found
     
    endif;
     
    ?>
    February 25, 2014 at 1:30 pm #92337
    Peter
    Member

    Does it work with other themes? Just a problem with Genesis? I'm not familiar with this addon but from the look of that code it looks like it belongs in the html of a template file (e.g, single.php, page.php, etc). I'm stating the obvious but it's probably best to ask the addon creator about this.

    February 25, 2014 at 3:57 pm #92352
    Simon Abramson
    Member

    Peter -- this'll work in any theme.

    I'm just not sure how to inject this PHP code into my single.php using a Genesis child theme. I would usually just edit the single.php file or another php file in the template hierarchy. Not so with Genesis though.

    I know Genesis has genesis_custom_field for calling custom fields... how would I mesh genesis_custom_field and if( have_rows('repeater_field_name') ): etc...

    February 25, 2014 at 5:21 pm #92361
    Peter
    Member

    Where do you want that data to appear in your theme specifically? Since it already works, then it's just a matter of adding it to the markup. Did you try something like this? In the functions.php file:

    function test_repeater_field_name() {
      if( have_rows('repeater_field_name') ):
        while ( have_rows('repeater_field_name') ) : the_row();
            the_sub_field('sub_field_name');
        endwhile;
      else : 
        // no rows found 
      endif;
    }
    add_action( 'genesis_loop', 'test_repeater_field_name' );
    February 26, 2014 at 9:03 am #92471
    Simon Abramson
    Member

    Thanks Peter! I realized it was that simple last night while washing some dishes.

    Funny how things click after some time.

    - Si

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble