Thumbnail to show on *SOME* Posts (single.php), but always on index.php (3 posts)

  1. chevas
    Posted 6 years ago #


    I have thumbnails enabled and I've implemented the small changes to make a larger version of the thumbnail appear on the single.php page. It works great.

    The problem I have is that I want to use the thumbnails always on the index.php, but on occasion, not have it appear on the single.php. Sometimes instead of showing the thumbnail on the signle post, I just want to show an embedded video.

    How can I disable the thumbnail from appearing on the single.php of *some* pages, but still have them appear on the index.php?


  2. esmi
    Forum Moderator
    Posted 6 years ago #

    Something like:

    if( !is_single(array(17, 19, 22, 33)) ) the_post_thumbnail();?>

    in single.php should work. 17, 19, 22, 33 would be the ids of the posts where you don't want a post thumb to be displayed.

  3. chevas
    Posted 6 years ago #

    Brilliant! Thank you. And for the uber-PHP noobs like myself, this is the actual statement I placed in the single.php file that ignores certain posts and references the settings I've specified in the functions.php (like ensuring that on the single pages, the thumbnail is actually larger)

    <?php if( !is_single(array(369, 452)) ) the_post_thumbnail( 'single-post-thumbnail' );?>

Topic Closed

This topic has been closed to new replies.

About this Topic