Advertisement
miriamdepaula

WordPress: Adicionando link no post_thumbnail

Aug 22nd, 2011
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1. //Adicionando e apontando o link do post_thumbnail para o seu respectivo post
  2.  
  3. add_filter( 'post_thumbnail_html', 'cms_post_image_html', 10, 3 );
  4.  
  5. function cms_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.  
  10.   return $html;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement