learn to create wordpress theme



For example, to generate a distinctive style sheet in a post only found within a specific category, the code might look like this:

if (is_category(9)) {
// looking for category 9 posts
include(TEMPLATEPATH . '/single2.php');
} else {
// put this on every other category post
include(TEMPLATEPATH . '/single1.php');
}
?>Or, using a query, it might look like this:

$post = $wp_query->post;
if ( in_category(‘9′) ) {
include(TEMPLATEPATH . ‘/single2.php’);
} else {
include(TEMPLATEPATH . ‘/single1.php’);
}
?>

Comments

Comments are closed.