Catagory Logic for WordPress Template

Sometimes when designing a wordpress site you need to be able to tell specific content where to appear depending on which category is being viewed. This can be achieved using an if statement combined with the in_category test.

Example:

if ( in_category('4') )
{
//do this
}
else if ( in_category('5') )
{
//do this
}
else
{
//do this
}
Post Info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Leave a Comment

NOTE: When posting a comment please do not paste in large blocks of code. Instead paste your code here and link to it in your comment. Thanks.

Browse by Category

Browse by Year

Credits