How to show the Post Featured Image in posts
-
Hello,
We have recently updated the theme from v225 to v361.
We use a child theme.In our child theme, in a modified single.php file we used the following code to show the featured image on the top of the posts, even when they were NOT image posts:
<?php $format = get_post_format(); if ( false === $format ) $format = array( 'standard', 'video' ); if ( $format == array( 'standard', 'video' ) ) { ?> <!-- add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link' ) ) --!> <div class="post-format"> <div class="image-container"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail('thumb-large'); $caption = get_post(get_post_thumbnail_id())->post_excerpt; if ( isset($caption) && $caption ) echo '<div class="image-caption">'.$caption.'</div>'; } ?> </div> </div> <?php } else get_template_part('inc/post-formats'); ?>
Unfortunately it does NOT work any more.
How should we modify the code to a working one after the latest changes to the theme?PS: I have read the post stating that “You need to use image post format so that featured image display within single post“.
That is NOT the “solution” we are looking for.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘How to show the Post Featured Image in posts’ is closed to new replies.