I am trying to manipulate the existing primary menu with a plugin.
The result should be: if the plugin is activated, it edits the 'Login' button to be conditional:
if something is true
show profile picture and name
else
show login button
There is still a long way to that result, right now I'm trying to generally manipulate the main menu with a custom Walker class
Here is my code:
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 )
{ ... }
}
But the only thing that happens is, that WordPress creates a new menu beside the main menu, with the same items on top of the page.