Display Featured Thumb In Post for Specific Category
-
Hi all, this is my first time on here, so I hope I don’t make a fool of myself! I’m not that familiar with PHP and WordPress’ definitions. Here’s what I want to do though:
Display the featured image of the post, in the post itself, for only posts in a certain category.I figured it would be written out like so:
<?php if (in_category( 'news' )) { if ( has_post_thumbnail()){ the_post_thumbnail(); } } ?>
I added it to my theme’s functions and it caused an error. Is the code wrong? Or did I just not place it in correctly?
The error message said “unexcepcted ‘>’ on line….”
p.s. I would preferably like to attach a class to the featured image that I can use to style it.
- The topic ‘Display Featured Thumb In Post for Specific Category’ is closed to new replies.