• Peter

    (@peterbatchelder)


    Is there a simple way to put my queried post_thumbnail_image into a div background, to force square crop? Here’s the code:

    <div id="featuretitle"><h1>Furniture</h1></div>
    <?php
    $cat_id = 6;
    $latest_cat_post = new WP_Query( array('posts_per_page' => 1, 'category__in' => array($cat_id)));
    if( $latest_cat_post->have_posts() ) : while( $latest_cat_post->have_posts() ) : $latest_cat_post->the_post();
    the_post_thumbnail();
    the_content();
     ?>
    <a href="https://summerhousefurnishings.farmroaddesign.com/?page_id=32"><div id="featurelink">View All Furniture</div></a>
    <?php endwhile; endif; ?>

  • The topic ‘_the_post_thumbnail as DIV background?’ is closed to new replies.