Change header menu login-logout without changing main menu

You should add a class to the header when the user is logged in, this way, only your css would have to change. You can do it like this in your header.php file : <header class=”header clear <?php echo ((is_user_logged_in())?’logged-in-header’:’not-logged-in-header’); ?>” role=”banner”>

How to get the title of root li element

In a nutshell, assuming you are using a walker to construct your menu. E.g. when customizing the start_el() method, the $item should be an object – somewhat – like the $post object. In reverse that means, you have access to post_parent property. With that information you can retrieve the title with get_the_title() easily. After your … Read more

Add extra markup to WP menus

When developing a menu on a bootstrap based theme, I now use the following Walker: ‘walker’ => new Custom_Walker_Nav_Menu class Custom_Walker_Nav_Menu extends Walker_Nav_Menu { // add classes to ul sub-menus function start_lvl( &$output, $depth ) { // depth dependent classes $indent = ( $depth > 0 ? str_repeat( “\t”, $depth ) : ” ); // … Read more