WordPress.org

Support

Support » How-To and Troubleshooting » Thumbnail to show on *SOME* Posts (single.php), but always on index.php

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

  • Hi,

    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?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi

    @esmi

    Forum Moderator

    Something like:

    <?php
    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.

    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' );?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Thumbnail to show on *SOME* Posts (single.php), but always on index.php’ is closed to new replies.
Skip to toolbar