Hi everyone,
I'd like to have a specific design for the posts of one category (no title, specific BG color, an icon at the beginning, etc. for instance).
I don't know PHP, so I'm completely clueless. I couldn't find a tuto on the net.
Anyone has suggestions ?
Vivien.
P.S : Sorry for my frenglish.. ;-p
Joshuwar
Member
Posted 2 years ago #
Hey Vivien- I'd be interested to hear whether there's a way of doing that too. Meanwhile I've been achieving roughly the same result by using this rather excellent post template plugin, which works like using a single page template... Hope that helps in the interim..
RGlover
Member
Posted 2 years ago #
If you're using WP 2.7+ with a 2.7+ compatible theme, each post should be getting a class that includes the category into which it is placed. (e.g. category-uncategorized, category-pictures, category-tutorials, etc.) You can check to see if that is indeed the case by examining your index.php file and looking for <?php post_class(); ?> in the element in which the post is contained (typically a <div> element).
If those things are true, and you're getting a category-x class for each of your posts, it should be a simple matter of adding the relevant CSS Styles to your stylesheet.
Hope that helps.
RGlover
Member
Posted 2 years ago #
Another way I suppose you could do the job would be to use the in_category() method to test whether or not the_post() was in the category you want styled differently, and then output different HTML if that is the case, but it would seem a little excessive to do things that way, particularly as post_class() is already there, and targeting specific CSS styles seems like the faster and more effective option in the long run.
Thank you all!!!
I'm going to test all that this WE and let you know.
Vivien
Joshuwar
Member
Posted 2 years ago #
Excellent thanks RGlover- I'd not come across that tag- should be very useful.