I need to insert some condition if the current page is a category page or not.
I found a way to do this by checking if $cat_idthis page is available or not, as follows.
$cat_id
$cat_id = get_query_var('cat');
Now we can check if $ cat_id is available, this is the category page, otherwise it is not.
you can use this to get a category
is_category(); is_category( '1' ); // where 1 is category id is_category( 'test' ); // where test is category name is_category( 'test-ing' ); // where test-ing is category slug
is_category();
.
refrence: http://codex.wordpress.org/Function_Reference/is_category
Amit , , Wordpress var $cat. , , , .
if(!empty($cat)){ //do something just on a category archive page }