Can I add a class to the <li>'s output by WordPress' wp_nav_menu() function?
I'm开发者_C百科 using a grid layout, and all the links in my menu need the class grid_1
, but WordPress automatically generates the classes page_item page-item-#
. How can I add my class to the li? I'm aware that I could alternately add an entry under .page_item
to my stylesheet, but I feel like that's more messy than it should be.
Thanks in advance!
There's not a way but you can add a custom class to the ul and use that to target your li's.
$args = array(
'menu_class' => 'myclass'
);
wp_nav_menu($args);
精彩评论