我正在尝试使用插件操作现有的主菜单。
结果应该是:如果插件被激活,它会将“登录”按钮编辑为有条件的:
if something is true
     show profile picture and name
else
     show login button
 要达到这个结果还有很长的路要走,现在我正在尝试使用
custom Walker class这是我的代码:
add_action( \'wp_loaded\', \'edit_that_shit\');
function edit_that_shit(){
    wp_nav_menu(
        array(
            \'theme_location\' => \'primary\',
            \'menu\' => \'Primary Navigation\',
            \'walker\' => new Custom_Walker()
        )
    );
}
class Custom_Walker extends Walker_Nav_Menu
{
     public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 )
     { ... }
}
 但唯一发生的事情是,WordPress在主菜单旁边创建了一个新菜单,页面顶部有相同的项目。