Support

Account

Home Forums ACF PRO How to achieve this (with repeater fields)?

Solving

How to achieve this (with repeater fields)?

  • Hello everone,

    I’m working for a client with AFC for the first time. I’m building the front-end with Elementor. So far so good but I’m facing a little issue right now:

    The concept of the website is comparing different holiday accomodations. Somewhere on the page my client like to show one or a few rows with a logo, name and button with url for the holiday providers. I thought using repeater fields for that.

    As far as I see Elementor can’t read the repeater fields (can not select them as a value) so maybe for what I need some code is required.

    Here you can see how the end result should be:

    Example of rows

    I have now repeater fields for these rows with the sub-fields: image, name and url.

    How do I get these displayed as in my example? Is there a way with Elementor or do I need a little code for that which creates one row per repeater field value?

    Thanks you in advance!

  • I’m not familiar with Elementor but have a feeling you need an add-on for certain fields (I could be wrong).

    Worth checking this tutorial on using repeater fields.

    May help!

  • Will look into that, thanks Jarvis!

    I found a video as well with custom code, tried to use it but got critical errors when code is executed 🙁

    Basic code for just extracting data:

    <?php if(have_rows('affiliateproviders')):?>
    
    <?php while( have_rows('affiliateproviders')): the_row;?>
    
    	 <?php the_sub_field('logoaanb');?>
    
    <?php endwhile;?>
    
    <?php endif;?>

    Someone familiar with this as well?

  • I was a little sleepy.. I forgot the () after ‘the_row’ what caused the critical error. Above code works good! 🙂

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

You must be logged in to reply to this topic.