• Resolved mcamposs

    (@mcamposs)


    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.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mcamposs

    (@mcamposs)

    
    // 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_menus you do not need to call add_theme_support( 'menus' ); function.

    After that, you will need to add menu_class and/or menu_id arguments to wp_nav_menus that 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.

    Thread Starter mcamposs

    (@mcamposs)

    Hello Anass,

    Excellent. Everything works perfect. Very good!

    Highly very grateful.

    Mario Campos

    Perfect!

    Glad to help you!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Problem with menu from scratch in wordpress.’ is closed to new replies.