Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am building a theme that includes the featured image as a navigation feature outside the single post, but once the user gets to the post in category "Specials", I'd like to take that image away. None of the other category posts require this lack of Featured Images. Theirs can be intact.

I can do it with JavaScript easily enough, targeting the div, but I'd like to do it server-side.

How can I isolate and remove a featured image from a specific category's posts?

share|improve this question

1 Answer 1

Something like this ought to work, in your single.php or whatever:

if(is_single() && has_term('specials', 'my_taxonomy', $post)){
    // do something not thumbnail-related
} else {
    the_post_thumbnail();
}

Not sure what your taxonomy is.

share|improve this answer
    
There isn't the_post_thumbnail in this file, though. The whole post is like this, in a while loop: get_template_part( 'content', get_post_format() ); –  Jon Mitten Aug 12 '13 at 18:31
    
Well, then go deeper into the rabbit hole and modify the part that was mentioned. Sounds like there may be multiple files.... 'content-aside.php', 'content-blah.php' or something. Somewhere, a thumbnail function is being called. –  GhostToast Aug 12 '13 at 18:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.