The featured image on pages does not show up. It works fine on a post.
Any thoughts on why it isn’t working? Thank you.
The featured image on pages does not show up. It works fine on a post.
Any thoughts on why it isn’t working? Thank you.
Hi @catch,
Thank you for your question.
You can display the featured image on single page by using the attached small plugin that contains the following code.
function travelify_before_post_content_add_image(){
if( is_page() ){
$image = '<a href="#" title="'.the_title( '', '', false ).'">';
$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
echo $image;
}
}
add_action( 'travelify_before_post_content' , 'travelify_before_post_content_add_image');
Best Regards,
Movin
Hello, Movin. I’ve tried this plugin and it seems to add a # character to the end of the url of the featured image, for example: http://www.asite.com# instead of http://www.asite.com. Any ideas on how to have the plugin just show the url of the page without the #? Thanks for your help.
In the above shared plugin code just find the # and remove it.