wp_nav_menu change sub-menu class name?

2019-01-05 09:27发布

Is there a way to change the child <ul class="sub-menu"> generated by Wordpress itself to a custom class name?

i know the parent ul you can remove or change the name with 'menu_class' => 'newname'

I couldnt find... tried 'submenu_class' => 'customname' :D seems logic to me, but obviously that is no the right one..

any ideas?

标签: wordpress
13条回答
疯言疯语
2楼-- · 2019-01-05 10:24

I had to change:

function start_lvl(&$output, $depth)

to:

function start_lvl( &$output, $depth = 0, $args = array() )

Because I was getting an incompatibility error:

Strict Standards: Declaration of My_Walker_Nav_Menu::start_lvl() should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array)

查看更多
登录 后发表回答