tlemaitre27
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Developing with WordPress
In reply to: Get the term of the current post in the current loop CPTHi!
Thank you for helping me.
My$termswas created before with this:$terms = get_terms('type_project');
I tried to put the foreach like you said but I get again the duplicate problem. With the foreach in the while loop, my code looks like this:<?php $terms = get_terms('type_project'); ?> <?php query_posts(array('post_type' => 'projet')); ?> <?php if(have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php foreach ($terms as $t) { ?> <div class="grid-item" data-filtre="<?php $t -> name ?>" style="background: url('<?php the_field('image_projet') ?>') no-repeat center center; background-size: cover"> <div class="box_infos"> <div class="red_overlay"></div> <p class="date_real"><?php the_field('date_projet') ?></p> <p class="nom_real"><?php the_field('nom_projet') ?></p> <p class="lieu_real"><?php the_field('lieu_projet') ?></p> </div> <div class="bar_plus"></div> </div> <?php } ?> <?php endwhile; ?> <?php else: ?> <h2>Aucun projet pour le moment</h2> <?php endif; ?> <?php wp_reset_query(); ?>Does I forget something important there?
Forum: Fixing WordPress
In reply to: Can I use taxonomy-{slug}-{term}.php in a different directory?Thank you very much for the help 🙂
Viewing 2 replies - 1 through 2 (of 2 total)