您好我想在wordpress中制作菜单。当菜单项具有类'category'
时,则添加到此项子菜单。我怎么能这样做?我试过这样,但它只添加了类。
add_filter('nav_menu_css_class' , 'my_special_nav_class' , 10 , 2);
function my_special_nav_class( $classes, $item )
{
if($item->title == 'kategorie' )
{
$classes[] ='special-class';
}
var_dump($item->title);
return $classes;
}