• First I would like to thank you for reading this thread.

    I just want to ask how can I pull the featured image of a post using the post_thumbnail_html?

    I really need to use the post_thumbnail_html because thats the only filter that the plugin use.

    Could you please give some examples using it on homepage?

    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter cloudstr210

    (@cloudstr210)

    Got this code on the net and added it to my functions.php

    add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
    function my_post_image_html( $html, $post_id, $post_image_id ) {
    	$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
    	return $html;
    };

    then to use it, use this code:

    <?php echo the_post_thumbnail('thumbnail'); ?>

    If you have a better suggestion please reply.

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Get the featured image using post_thumbnail_html’ is closed to new replies.