Home Forums Front-end Issues Display taxonomy image in WP_Query Reply To: Display taxonomy image in WP_Query

  • Hey John, thanks for you answer. I tried but it results in nothing. My posts are well associated with a category and those categories have a “logo_image” in place. I think i’m dumb AF or it’s just because i’m a frontend guy, can you help me out a little bit more? You’d be my xmas angel! <3

    $terms = wp_get_post_terms();
    // args
    $args = array(
      'order'       => 'DESC',
      'orderby'     => 'date',
      'posts_per_page'	=> -1,
      'post_type'		=> 'post',
    // query
    $posts_query = new WP_Query( $args );
    <?php if( $posts_query->have_posts() ): ?>
      <?php while ( $posts_query->have_posts() ) : $posts_query->the_post(); ?>
      <div class="swiper-slide">
        <a href="<?php the_permalink(); ?>" class="c-card-article">
          <div class="c-card-article__img mb-15">
            <div class="c-card-article__overlay">
              <i class="icon-arrow-right"></i>
              <div><?php _e('Plus de d├ętails', 'credo'); ?></div>
              foreach ($terms as $term) {
                $image = get_field('logo_image', $term);
            <?php the_post_thumbnail( 'large', array( 'class' => 'u-w-100' ) ); ?>
          <p><?php the_title(); ?></p>
      <?php endwhile; ?>
    <?php endif; ?>
    <?php wp_reset_postdata(); ?>