Support

Account

Home Forums General Issues Query in a taxonomy field Reply To: Query in a taxonomy field

  • Nevermind, I find a way.
    Here is my code in case someone would do it:

    			<?php 
    			$terms = get_field('categories_a_afficher', 'option');
    			if( $terms ): ?>
    				<?php foreach( $terms as $term ): ?>
    					<div class="category_list">
    						<h2 class="fond">
    							<?php echo $term->name; ?>
    						</h2>
    						<a href="<?php echo get_term_link( $term ); ?>">
    							<?php _e( 'View all posts from', 'twentyeleven' ); ?> <strong><?php echo $term->name; ?></strong>
    						</a>
    						<!-- Here the query begin -->
    						<?php query_posts( 'showposts=2&order=DSC&cat=' . $term->term_id . ''); if (have_posts()) : while (have_posts()) : the_post(); ?>
    				    		<?php get_template_part( 'content', get_post_format() ); ?>
    				        <?php endwhile; endif; wp_reset_query(); // On ferme la boucle ?>
    						<?php //echo $term->term_id; ?>
    					</div><!-- .category_list -->
    				<?php endforeach; ?>
    			<?php endif; ?>