Current Category Id Function

<?php function getCurrentCatID(){

global $wp_query;

if(is_category() || is_single()){

$cat_ID = get_query_var('cat');
}

return $cat_ID;

}

echo getCurrentCatID();

?>

0 Comments

You must be logged in to post a comment.