Hello @rolfvp,
The error is because your theme is using excerpt to be displayed over blog listing page if you will change it to ‘full post’ under customize->post options section then it will show your image also.But if you still want to show excerpt on blog listing page then paste this code in theme’s functions.php file
function retain_image_excerpt($value) {
global $post;
if ( '' == $value ) {
$value = get_the_content('');
$value = apply_filters('the_content', $value);
$value = str_replace('\]\]\>', ']]>', $value);
$value = preg_replace('@<script[^>]*?>.*?</script>@si', '', $value);
$value = strip_tags($value, '<img />');
$excerpt_length = 55;
$alphabates = explode(' ', $value, $excerpt_length + 1);
if (count($alphabates)> $excerpt_length) {
array_pop($alphabates);
array_push($alphabates, '[...]');
$value = implode(' ', $alphabates);
}
}
return $value;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'retain_image_excerpt');
Please Note: If you are not dealing with child theme, you’ll lose this code snippet on theme updation.
Thanks.
-
This reply was modified 8 years, 4 months ago by
Adarsh Verma.