I have to insert some condition if the current page is a category page or not.
Leave a Reply
You must be logged in to post a comment.
I have to insert some condition if the current page is a category page or not.
You must be logged in to post a comment.
you can use this for getting category
I have found the way to do it by checking if
$cat_id
is available or not on that page by the following.Now we can check if $cat_id is available then it is a category page otherwise it is not.
You can use
function.
refrence:
http://codex.wordpress.org/Function_Reference/is_category
Amit’s answer will work but there is a simpler way as WordPress sets a Global var for the category id of $cat. So just checking if this is set will tell you if you are on a category page.