Advertisement
miriamdepaula

WordPress - teste para a Gislaine

Aug 22nd, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. //teste para a Gi
  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.     if( is_singular(array('produtos', 'maquinas')) ){
  8.    
  9.         $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'large');  
  10.         $html = '<a rel="lightbox" href="' . $large_image_url[0] . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
  11.    
  12.     } else {
  13.        
  14.         $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
  15.  
  16.     }      
  17.  
  18.   return $html;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement