Problem with menu from scratch in wordpress.
-
I’m creating a theme in wordpress from a Bootstrap 4 template.
But I have a problem with the menu. When I add any menu plugins in the dashboard, none of them work in the frontend, always showing an unordered list items.
I deleted all the bootstrap code.
Function.php:// Registramos 2 Menús add_theme_support('nav-menus'); function registrar_mis_menus() { register_nav_menus( array( 'menu-header' => __( 'Menú Páginas Superior' ), 'menu-footer' => __( 'Menú Páginas Footer' ) ) ); }header.php
<?php wp_nav_menu( array( 'theme_location' => 'menu-header', ) ); ?>I have wordpress 4.9.2. The latest versions of WP Mega Menu, Max Mega Menu, Responsive Menu, etc..
-
This topic was modified 7 years, 11 months ago by
mcamposs.
-
This topic was modified 7 years, 11 months ago by
-
// Registramos 2 Menús add_theme_support('nav-menus'); function registrar_mis_menus() { register_nav_menus( array( 'menu-header' => __( 'Menú Páginas Superior'), 'menu-footer' => __( 'Menú Páginas Footer') ) ); } add_action( 'init', 'registrar_mis_menus' );-
This reply was modified 7 years, 11 months ago by
mcamposs.
Hello there!
First of all, here you have a more practice code of how to register navigation menus in WordPress programmatically.
// Register Navigation Menus function ar_navigation_menus() { $locations = array( 'menu_header' => __( 'Menú Páginas Superior', 'text_domain' ), 'menu_footer' => __( 'Menú Páginas Footer', 'text_domain' ), ); register_nav_menus( $locations ); } add_action( 'init', 'ar_navigation_menus' );As you can see, with the function
register_nav_menusyou do not need to calladd_theme_support( 'menus' );function.After that, you will need to add
menu_classand/ormenu_idarguments towp_nav_menusthat your theme is using to design the menus.You have a lot of arguments that you can discover on the link down bellow, and all the posibilites they can help you to make a great menu.
https://developer.wordpress.org/reference/functions/wp_nav_menu/
Let me know if this helps you.
Hello Anass,
Excellent. Everything works perfect. Very good!
Highly very grateful.
Mario Campos
Perfect!
Glad to help you!
-
This reply was modified 7 years, 11 months ago by
The topic ‘Problem with menu from scratch in wordpress.’ is closed to new replies.