Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tlemaitre27

    (@tlemaitre27)

    Hi!
    Thank you for helping me.
    My $terms was 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?

    Thread Starter tlemaitre27

    (@tlemaitre27)

    Thank you very much for the help 🙂

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