I am building a theme in Wordpress where I need to register menus on the go.
The code below works just fine, but it's static (in functions.php)
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
'footer-menu' => __( 'Footer Menu' ),
'left-menu' => __( 'Left Menu' )
)
)};
However, I have my menu list stored in the array below. How do I use this in register_nav_menus above? I tried to run a foreach, but it's not so easy to do that inside of an array, right?
$list_of_menus[];
The array above contains the following:
'fdsfds_fds' => __( 'fdsfds fds' ),
'Its_my_life' => __( 'Its my life' ),
'header-menu' => __( 'Header Menu' ),
'footer-menu' => __( 'Footer Menu' ),
'left-menu' => __( 'Left Menu' )
Thank you!
register_nav_menus($list_of_menus);- assuming your list is in the proper format, of course.