• Hello,

    Is there anyway to set the displayed image for each post by using the first image in the actual post?

    At the moment all I can see is that you use the featured image to display for each post.

    I personally don’t use featured images for my photography website as I host my images on Smugmug, and link to them in my posts.

    I can’t see that this is a feature in the paid version either, but it would be really handy, at least for me!

    Thanks in advance for any suggestions/help…

    Tony.

Viewing 1 replies (of 1 total)
  • Plugin Author Tom

    (@edge22)

    Sorry for not getting back to you sooner!

    Tough question, I don’t really have the full answer.

    I know you can filter into the featured image HTML and set a default if the featured image doesn’t exist:

    add_filter( 'post_thumbnail_html', 'my_post_thumbnail_html' );
    function my_post_thumbnail_html( $html ) {
    
    	if ( empty( $html ) )
    		$html = '<img src="' . trailingslashit( get_stylesheet_directory_uri() ) . 'images/default-thumbnail.png' . '" alt="" />';
    
    	return $html;
    }

    Then you might be able to grab the first image from your content, but I’m not sure how good this code is: https://css-tricks.com/snippets/wordpress/get-the-first-image-from-a-post/

Viewing 1 replies (of 1 total)
  • The topic ‘Override featured image?’ is closed to new replies.