Category thumbnail as background image
-
How would I get the category thumbnail to be used as a background image? Primarily in category.php, but also in single.php
I am using this code to display the post thumbnail as a background image:
<?php $image_attributes = (is_singular() || in_the_loop()) ?
wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ),
‘full’ ) : null; ?>
<div class=”jumbotron jumbo-bkg” style=”<?php if($image_attributes)
echo ‘background-image:url(\”.$image_attributes[0].’\’)’ ?>”>
</div>
- The topic ‘Category thumbnail as background image’ is closed to new replies.