WordPress.org

Ready to get started?Download WordPress

Forums

Feature Request: Make post thumbnail a link to the post (6 posts)

  1. Jonas Grumby
    Member
    Posted 4 years ago #

    The new post thumbnail feature is great but in search results and archive pages the thumbnail should be clickable (i.e. linked to the post). Not sure if that can be built into WP or if it has to be built into the theme. I am using Atahualpa on a site and the post thumbnails look great but it sure would be nice if they were clickable.

    Thanks

  2. bellomedia
    Member
    Posted 4 years ago #

    i need the same thing too, but no one on the internet seem to care of us :)

  3. That's your theme, not WP itself.

    Lots of themes do that (Hybrid for example). You just have to design the archive page.

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    here's an option...adding:

    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;
    }

    to functions.php made each thumbnail a link to the permalink

  5. FYI, as your functions.php is a theme file, this is still a Theme Change :)

  6. flyboy-sd
    Member
    Posted 4 years ago #

    This is great! I was looking for this. I'm surprised it's not a core part of WordPress.
    So I did this and it worked great on my home page but in my search pages (i.e. view all posts in a category), it is no longer active. Any ideas?
    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic