• I have been able to get the excerpt to show on the categories page thanks to this post but I would now like to add the thumbnail (if present) to the display as well. I am not sure how to make it left align with the text on the right.

    Thanks in advance for any assistance.

Viewing 1 replies (of 1 total)
  • Hi @kriis: I checked over the post you linked to and wanted to highlight that edits should not be made directly to a theme’s files. Any direct edits will be lost when it comes time to update your theme.

    Instead, you should create a child theme in order to customise and make changes to your theme’s underlying code. You can find more information about child themes, including steps to get set up, in the following guides:

    Copy/paste the loop.php file from the parent to your child theme’s directory and then make any edits you wish there.

    To add your post’s thumbnail, you can make use of the_post_thumbnail() function:

    https://developer.www.ads-software.com/reference/functions/the_post_thumbnail/

    Adding the following beneath <div class=”entry-summary”> would add your post’s featured image alongside its excerpt:

    <?php if ( has_post_thumbnail() ) : ?>
    	<div class="post-thumbnail">
    		<?php the_post_thumbnail(); ?>
    	</div>
    <?php endif; ?>

    You can then use some custom CSS to style .post-thumbnail to your liking. If you can share a link to your site, I may be able to help with more specific CSS.

    Let me know how you get on with that or if you have any questions.

Viewing 1 replies (of 1 total)
  • The topic ‘Thumbnail in Excerpt’ is closed to new replies.