/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getCurrentCatID(){ global $wp_query; if(is_category() || is_single()){ $cat_ID = get_query_var('cat'); } return $cat_ID; } //To get the full category object, try this: $cat = get_category(get_query_var('cat'),false);