how to show feature image in page?
i know we can show feature image in post. however, how to show in page?
thanks.
how to show feature image in page?
i know we can show feature image in post. however, how to show in page?
thanks.
Take this code and add it somewhere in travelify_theloop_for_page
function which you can find in content-extensions.php
file located in theme folder - library - structure.
<?php
if( has_post_thumbnail() ) {
$image = '';
$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
$image .= '<figure class="post-featured-image">';
$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
$image .= '</figure>';
echo $image;
}
?>
Personally I would add it right before <header class="entry-header">
but you can play around to get the results you were looking for.