• Hello,

    In my blog the thumbnail feature is enabled. However, I would like that this feature was enabled only to certain categories. Eg.: I have two categories, in which the posts associate to them go to the home page – to these categories I want the thumbnails enabled. However, I have other posts associate to other categories, which don’t go the home page – to posts from these categories, I would like do disable the thumbnail feature. Is this possible?

    Thanks in advance,
    Fábio Vasques

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can’t disable post thumbnails on a per-category basis but you could stop any post thumbnails from being displayed for certain categories using the is_category conditional.

    Thread Starter fabiovasques

    (@fabiovasques)

    Hi,

    Thanks for your quick response!
    Could you please be more specific? I’m not very familiar with PHP…just know how to change the basic…

    Thanks again!
    Fábio

    <?php
    // don't show thumbnail for categories 3, 7 & 9
    if( !is_category( array(3,7,'9') ) ) the_post_thumbnail();
    ?>
    Thread Starter fabiovasques

    (@fabiovasques)

    Thanks for the code! I understood that I have to adapt it to my categories. In your example, the last category (9) is between ”, right?
    Only one last help: in which file do I insert it?

    I tried in a few files, but didn’t work. Eg.: When I’ve inserted the code in the “post-thumb.php” file, didn’t work to the selected categories (thumbnails were still showing) and in the non-selected categories the thumbnail got bigger.

    Thanks again for your help and your patience!
    Fábio

    Typo. It should have read:

    <?php
    // don't show thumbnail for categories 3, 7 & 9
    if( !is_category( array(3,7,9) ) ) the_post_thumbnail();
    ?>

    No single quotes.

    Thread Starter fabiovasques

    (@fabiovasques)

    Thanks! In which file should I insert this code?

    Thanks in advance
    Fábio

    In your theme’s category template file. Either category.php. archive.php or index.php – depending upon the theme.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Disabling thumbnails from certain categories’ is closed to new replies.