I was development a section a in my #wordpress theme I need the current category from url, here is I figure out how to get category from url.
[php]
$page_position = strpos($_SERVER[‘REQUEST_URI’],’page’);
if($page_position!==false){
$CAT_URL = substr($_SERVER[‘REQUEST_URI’],0,$page_position);
} else {
$CAT_URL = $_SERVER[‘REQUEST_URI’];
}
$urlslugArray = array_filter(explode(‘/’,$CAT_URL));
$get_the_category = get_category_by_slug(end($urlslugArray));
if($get_the_category){
$tagtut_title = $get_the_category->name;
$tagtut_desc = $get_the_category->category_description;
$posts_found = $get_the_category->count;
}
[/php]