Home Forums ACF PRO Total noob, trying to display repeater…


Total noob, trying to display repeater…

  • Hey everyone,

    So yeah, i’m a total noob at this stuff, and am having trouble displaying a simple repeater that i have setup called ‘p2services’, it has two sub fields ‘serviceicon’ and ‘servicetitle’.

    I am now using the code from ACF documentation:

    	<div class="circlecontainer">		
    // check if the repeater field has rows of data
    if( have_rows('p2services') ):
     	// loop through the rows of data
        while ( have_rows('p2services') ) : the_row();
            // display a sub field value
    else :
        // no rows found

    Nothing shows,

    The site is

    Thanks for any help or suggestions!

  • Is the code above inside the main loop for the page?

    Just in case you don’t know, the main loop starts with if (have_posts())

  • Hi john!

    Thanks for the reply,

    Hmm, I have taken all the default code out except for content, as this sote will be a heavily customized theme. ..

    So youre saying I need to pop that loop in the have posts loop?

    Isnt that loop for displaying blog entries?

    I will dig up the original code and will try it your way 🙂

    Thanks john

  • That’s a common error for noobs (sorry, just using your term). The loop need to be here even on a single post page, without it WP doesn’t know how to show the post. Some things you learn the hard way. I can remember the first site I built and trying to figure out why in the world they have a loop to show one post….

  • It gets easy to add once you’ve done it a few dozen or a few hundred times

    if (have_posts()) {
      while (have_posts()) {
        // do stuff for post here
  • Thanks john!

    Haha, you’re telling me. It wasnt long ago I was using dreamweaver at uni… how useful that was…not. lol.

    Yeah, this whole world of wordpress is very trial and error for me. .

    Can I pop that loop anywhere? My home.php is really 5 pages, broken up into sectons, (divs),could I stick that loop under say section 4?

    Thanks so much for your words of wisdom john, half way through a 14 hr day at fruitshop and I couldn’t be more eager to race home and code haha

  • The loop should be around everything that’s going to get any information about the post or custom fields.

    I actually use DW for editing WP, it’s a great coding IDE

  • Hmm i’m not quite sure what you mean John,

    i’m not sure if i’m using ‘posts’… what is a post exactly? check out my attached file, you’ll see the whole thing is treated like html/css, there’s no commenting/blogging functionality, just divs and css, and hopefully a few ACFs, lol.

    I have added the post loop… it doesn’t look right, meaning it is definitely in the wrong spot, (i’m sure your code is valid!)

    The original post loop (from the original page.php, before duplication) is included in the comments there, doesn’t seem to be working either…

    thought attaching the file is better than this multi-line forum code view…

    (And by the way, i loved dreamweaver! i can’t stand this wordpress platform, it’s so complicated, i used to just make bootstrap template sites using dreamweaver, straight up html,css and a lil’ js. perfect. just no custom field possibilities… After graduating, and looking for work, (melb, aust.) EVERYONE uses wordpress, NO-ONE uses dreamweaver… i can’t understand why… ACFS?)

    Thanks for any insight, Lord Commander John, of the WordPress Watch.

  • You can delete the code I told you to add, the original loop was in the correct place. I also forgot that you didn’t need the if portion of it on a single page.

    The reason it didn’t work is that you didn’t put php tags <?php ?> around the code you added.

    But that doesn’t matter, like I said the original loop is in the right place for what you’re doing.

    Just out of curiosity, what are you using to edit code if you’re not using DW?

  • I missed you’re first question

    What are posts?

    Everything is a post in WP, or almost everything. Posts have different names. a post can be a “Blog Post” which is a post_type of “post”. A post can also be a “Page” which is a post_type of “page”. Media library files are also posts and they are a post_type of “attachment”.

  • Okay… so i have left in the original loop from page.php, and have added php tags around the subfields… something is still wrong…(see attached)

    Ahh ever since this internship, i’ve swapped to using NotePad++, it’s really neat and simple, if i used mac, it would be Coda for sure. (not really out of preference, just what everyone else is using)

    And thanks for the low down on Posts, even just the logic and terminology is enough for a short course… haha.

  • You have a few php tags missing. Once got thing about DW is that is shows you lines with syntax errors.

Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘Total noob, trying to display repeater…’ is closed to new replies.