Wordpress PHP question
- Started
- Last post
- 2 Responses
- Sep
In my wordpress theme-files I use these a lot to call different classes, custom sidebars for different pages, custom headers for different categories...
<?php if ( is_home() ) { ?> ...
<?php if ( is_page("pagename") ) { ?> ...
<?php if ( is_single() ) { ?> ...
<?php if ( is_category("categoryname") ) { ?> ...They're really helpfull to get rid of the "bloggy" look...
Now I'm looking for a way to combine
<?php if ( is_single() ) { ?>
with
<?php if ( is_category("categoryname") ) { ?>In other words, it's no problem to assign a class to a category, but can you assign the same class to a single post from that category? A class different from the one you use on all other single pages, specifically for that category?
If anyone has any input, much appreciated as always.
- Vwprincess220
if( is_single() && in_category( 'category' ) ) {
// additional code
}One of the great things about WordPress is it's documentation.