loop – How home my code doesn’t display any feature image? Looping through post from a taxonomy and not getting feature images back

Question

The only thing I am trying to do is just to display each post from Services that belongs to the taxonomy called ‘national’ and display its title and its featured image. So far it displays each title correctly but for some reason Featured images are simply not working.

<div class="container">
    <div class="row d-flex justify-content-center">
        <?php
        $args = array(
            'post_type' => 'services',
            'posts_per_page' => 30,
            'state' => 'national'
        );
        $the_query = new WP_Query( $args ); ?>
        <?php if ( $the_query->have_posts() ) : ?>
        <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

                <div class="col-md-3">
                    <?php the_post_thumbnail(); ?>
                    <?php the_title( '<h2>', '</h2>' ); ?>
                </div>
        <?php endwhile; ?>
        <?php endif ?>
  </div>
</div>

0
fjimenez 4 weeks 2022-09-01T17:17:42-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse