Welcome! To use this support forum, please Login or Join Today!

   

Hide thumbnails on single page

{name}
Rank

Total Posts: 2

Joined 2012-10-16

PM

 

Hi,

When I use a featured image to show the thumnail on the [latest] post (thumbs=“true”)
-> see my home page: http://www.skillproof.com at the bottom

then they also appear on the Singles page.

-> see singles page: http://www.skillproof.com/2012/10/us-online-job-market-august-2012-week-2-labor-demand-declines-0-3/


How can I have a thumbnail in the [latest] post and none on the Singles page?

Henning

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

Yes, you can hook into the st_before_content() function. See the example below. This allows you to hide single post images but also offers a way for you to show in specific categories if you ever have the need.

Add this to your functions.php (Appearance → Editor → Functions)

/*-----------------------------------------------------------------------------------*/
// Handle image display images on single posts
/*-----------------------------------------------------------------------------------*/

function st_addSingleImage() {
 global $post;
 $image  = '<a rel="prettyphoto[group]" href="'.get_image_path().'">';
 $image .= get_the_post_thumbnail($id, 'video43', array('class' => 'alignleft scale-with-grid'));
 $image .= '</a>';

 // show the image in 'foo' category
 if (in_category('foo')) {
  echo $image;
 // hide everywhere else
 } else {
  $image = null;
 }

}
add_action('st_before_content','st_addSingleImage',1);

{name}
Rank

Total Posts: 2

Joined 2012-10-16

PM

 

Casey,

Thank you, that works great!