• Resolved paulawro

    (@paulawro)


    I’ve been trying to get into the habit of using a featured image with all my posts, not just photo and gallery ones, and I’d like them to show up on the individual post page, not just on the main blog. Unfortunately, I can’t seem to figure out how to do this. Can anyone help, please?

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • To do that you’ll need to create a child theme and edit a few template files to add the featured image for all post formats. Would you be comfortable doing that?

    Making a child theme means your changes won’t be overwritten when you update the theme. If you’re new to child themes, you can explore these guides:

    https://codex.www.ads-software.com/Child_Themes
    https://op111.net/53/
    https://vimeo.com/49770088

    Let me know if you’d like to go this route and whether you need help modifying the necessary template files.

    Thread Starter paulawro

    (@paulawro)

    Yeah, that’s not a problem. I was thinking that’s what I could have to do, but I have no idea what code I would actually need to add, and into what files, so any help you can give me would be appreciated. ??

    Cool. So let’s look at content-single.php. Make a copy of this file and place it in your child theme.

    If you look at lines 10-14, you’ll see that a condition is being added to only display the post thumbnail (aka featured image) for posts with the image post format.

    <?php if ( '' != get_the_post_thumbnail() && 'image' == $format ) : ?>
    	<figure class="entry-thumbnail">
    		<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail( 'index-thumb' ); ?></a>
    	</figure>
    <?php endif; ?>

    If you carefully remove this part of the first line:

    && 'image' == $format

    …you’ll remove the condition that checks for an image post format, and the featured image will now show on all post formats, if one exists on the post.

    I just tested it on my end and I think it does what you’re after – let me know how it goes!

    Thread Starter paulawro

    (@paulawro)

    Oh my gosh, that worked perfectly. Thank you so much for your help! ??

    Wonderful, glad that did the trick and you’re very welcome. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘featured image in standard posts’ is closed to new replies.