Home Forums Add-ons Repeater Field Multiple Repeater fields on single template woes


Multiple Repeater fields on single template woes

  • Hi folks,

    I am trying to get two repeater sections to work, the first shows but the latter doesn’t. I have removed the first repeater code in order to get the 2nd to show but still doesn’t work.

    Here is the code:

    					<?php if( have_rows('woocommerce_category_boxes') ):?>
    						<ul class="woocommerce-products-cats">
    								<?php // loop through the rows of data
    									while ( have_rows('woocommerce_category_boxes') ) : the_row(); ?>
    									<img src="<?php the_sub_field('image'); ?>" />
    									<?php the_sub_field('title'); ?>
    									<?php the_sub_field('link'); ?>
    									else :
    									// no rows found?>
    				<?php endif;?>

    Second Repeater:

    <?php if( have_rows('woocommerce_on_sale_boxes') ): ?>
    	<?php while( have_rows('woocommerce_on_sale_boxes') ): the_row(); 
    		// vars
    		$image_product = get_sub_field('image_product');
    		$title_product = get_sub_field('title_product');
    		$link_product = get_sub_field('link_product');
    		$price_product = get_the_field('price_product');
    			<?php if( $link_product ): ?>
    				<a href="<?php echo $link_product; ?>">
    			<?php endif; ?>
    				<img src="<?php echo $image_product['url']; ?>" alt="<?php echo $image_product['alt'] ?>" />
    			<?php if( $link_product ): ?>
    			<?php endif; ?>
    		    <?php echo $title_product; ?>
    				<?php echo $price_product; ?>
    	<?php endwhile; ?>
    <?php endif; ?>

    Any suggestions? Cheers πŸ™‚

  • Found my issue I wrote:

    $price_product = get_the_field('price_product');

    Should have been

    $price_product = get_sub_field('price_product');

    Cheers πŸ™‚

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.