Posted By

gamblelyn on 11/03/11


Tagged

wordpress


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

zemonte


Link featured post thumbnail in wordpress


 / Published in: PHP
 

URL: http://wordpress.org/support/topic/making-post-thumbnail-link-to-post

  1. // THIS LINKS THE THUMBNAIL TO THE POST PERMALINK
  2.  
  3. add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
  4.  
  5. function my_post_image_html( $html, $post_id, $post_image_id ) {
  6.  
  7. $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
  8.  
  9. return $html;
  10. }

Report this snippet  

You need to login to post a comment.