• Resolved tactics

    (@tactics)


    Hey folks,

    Just purchased the Exbico Pro theme. Nice looking theme, but the menu is not accessible, so here I am.

    Installed the plugin and I get this error when trying to set up the menu:

    “There are currently no menu locations registered by your theme.”

    Here’s my theme’s functions code:

    register_nav_menus( array(
    ‘menu-1’ => esc_html__( ‘Primary’, ‘exbico-pro’ ),
    ) );
    register_nav_menus( array(
    ‘menu-2’ => esc_html__( ‘Side-menu’, ‘exbico-pro’ ),
    ) );

    And header code:

    wp_nav_menu( array(
    ‘theme_location’ => ‘menu-1’,
    ‘menu_id’ => ‘primary-menu’,
    ‘menu_class’ => ‘nav-menu mobile-menu navigation’,
    ) );

    Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author megamenu

    (@megamenu)

    Hi tactics,

    register_nav_menus should be called within ‘after_theme_setup’, like this:

    if ( ! function_exists( 'mytheme_register_nav_menu' ) ) {
    
    	function mytheme_register_nav_menu(){
    		register_nav_menus( array(
    	    	'primary_menu' => __( 'Primary Menu', 'text_domain' ),
    	    	'footer_menu'  => __( 'Footer Menu', 'text_domain' ),
    		) );
    	}
    	add_action( 'after_setup_theme', 'mytheme_register_nav_menu', 0 );
    }

    (example taken from this page: https://developer.www.ads-software.com/reference/functions/register_nav_menus/)

    I think your best option would be to create a new menu location within the plugin (Mega Menu > Menu Locations > Add New Location), then paste the PHP Code (in the Display Options tab) into your header.php file.

    Regards,
    Tom

    Thread Starter tactics

    (@tactics)

    Hi Tom,

    Following your instructions, here’s what I did:

    1. I went to Mega Menu > Menu Locations > Add New Location and added a location called “Primary Menu”.
    2. Then I went into header.php and replaced all the code within <!–menu–> block with the following:
    <?php
    add_action( 'after_setup_theme', 'register_my_menu' );
    if ( ! function_exists( 'mytheme_register_nav_menu' ) ) {
    
    	function mytheme_register_nav_menu(){
    		register_nav_menus( array(
    	    	'primary_menu' => __( 'Primary Menu', 'text_domain' ),
    	    	'footer_menu'  => __( 'Footer Menu', 'text_domain' ),
    		) );
    	}
    	add_action( 'after_setup_theme', 'mytheme_register_nav_menu', 0 );
    }
    ?>

    When I go back to the mega menus setup it still says “There are currently no menu locations registered by your theme.” and I have no nav menu at all in my header anymore.

    What am I missing here?

    • This reply was modified 10 months, 1 week ago by tactics.
    Plugin Author megamenu

    (@megamenu)

    Hi Tactics,

    That code should live in your functions.php file, not in the header.php file, but ignore that bit as you don’t need it if you follow my instructions below.

    Please simply follow this:

    I think your best option would be to create a new menu location within the plugin (Mega Menu > Menu Locations > Add New Location), then paste the PHP Code (in the Display Options tab) into your header.php file.

    Regards,
    Tom

    Thread Starter tactics

    (@tactics)

    Forgive me if I’m missing something, but I don’t see a “display options tab” anywhere.

    Thread Starter tactics

    (@tactics)

    OK, I got it to work finally! Only issue is the mobile menu isn’t displaying now. I’ll start a new thread for that. Thanks for all your assistance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can’t get it to work with Exbico theme’ is closed to new replies.