Support

Account

Home Forums Add-ons Repeater Field Repeater with post_object in loop wp_query

Solved

Repeater with post_object in loop wp_query

  • Hello,

    I have a problem with my loop.
    In the result of my post_object display maximum one post.

    <?php $query = new WP_Query( array( 'post_type' => 'nosmarques' ) );                
    if ( $query->have_posts() ) : ?>
    	<?php while ( $query->have_posts() ) : $query->the_post(); ?>   
    		<div id="popup<?php the_ID(); ?>" class="popup_block">
    			<div class="center">
    				<?php the_post_thumbnail(); ?>
    				<span class="h1 dispo"><?php _e( 'Disponibilitรฉs', 'territoiredhomme' ); ?></span>
    			</div>
    			<?php if( have_rows('brand_in_shop') ): ?>
    				<ul class="shop-brand globe">
    					<?php while ( have_rows('brand_in_shop') ) : the_row(); ?>   
    						<li class="inline-block">
    						    <?php $post_object = get_sub_field('shop_sales'); ?>
    						    <?php if( $post_object ): ?>
    						 		<?php $post = $post_object; setup_postdata( $post ); ?>
    						 			<a class="uppercase" href="territoiredhomme/nos-boutiques/">
    						                <?php the_title(); ?>
    						            </a>
    						        <?php wp_reset_postdata(); ?>
    						    <?php endif; ?>
    						</li>	 
    					<?php endwhile; ?>	 
    				</ul>
    			<?php endif; ?>		 
    		</div>	
    	<?php endwhile; wp_reset_postdata(); ?>
    	<!-- show pagination here -->
    	<?php else : ?>
    	<!-- show 404 error here -->
    <?php endif; ?>

    Any ideas ?

    Thx

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.