WordPress.org

Ready to get started?Download WordPress

Forums

Can I get all user-created menus at once? (2 posts)

  1. johnrork
    Member
    Posted 4 years ago #

    Is there a way I can get all the available user-created menus at once rather than calling them each by individual name or id?

  2. johnrork
    Member
    Posted 4 years ago #

    Anything patently stupid about doing it this way?

    <?php
    
    $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
    
    foreach ( $menus as $menu ):
    
    ?>
    	<ul class="menu-class">
      		<a href="#" class="menu-title"><?php echo $menu->name; ?></a>
    		<?php wp_nav_menu(array('menu' => $menu));?>
    	</ul>
    
    <?php endforeach; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic