Full control over WordPress menus.

Sometimes you just need 100% control over your WordPress menus.

Calling wp_nav_menu() directly has its place, but typically your walker function that might generate a Bootstrap compatible main menu might not be ideal for a footer, location selection, or sidebar link list.

Using wp_get_nav_menu_items() will give us access to every part of the menu object. Title, Link, Calss name, and window location.

<? $location_menu = wp_get_nav_menu_items('Custom Menu'); 
foreach ($location_menu as $location): ?>
    <li><a href="<?= $location->url ?>"><?= $location->title ?></a></li>
<? endforeach; ?>

Don’t forget to register your custom menu!

register_nav_menus( array(
    'custom-menu' => 'Custom Menu'
) );

Signup for my mailing list

Receive other rambings like this on design, code, and some times food.