I have this CSS setup for my blog posts meta information. But there are certain categories where I would like to use another image in the same spot and not display the meta information. I’m not quite sure how to do it.
.entry-meta {
background: url("images/dish_blogtitle.png") no-repeat scroll center center transparent;
color: #666666;
float: left;
font-size: 13px;
font-style: italic;
height: 100px;
line-height: 18px;
margin-left: -125px;
margin-top: 5px;
position: relative;
text-align: center;
top: -80px;
width: 100px;
}
Have you checked the classes on your
<body>
element?It depends on the theme but WordPress has a function
body_class()
that dynamically adds a bunch of useful classes in there. It may look like this:
As you can see it is a powerful helper as you can easily accomplish complex style changes by prepending your definitions with these classes. In your case it could be:
If there is no such awesomeness in your
<body>
element then you can add it there yourself very easily:The answer provided by @xLRDxREVENGEx is certainly valid and points in the right direction. It’s certainly worth (re)thinking what approach is the right one for your use case.
Hope this helps!
You are doing it write but you should think about looking into WordPress template hierarchy structure. Check out this page from the wordpress codex http://codex.wordpress.org/Template_Hierarchy
In your template folder create a file with category-slug.php or category-id.php
replace the slug word with the slug you assigned the category or put the id that is assigned to the category