Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22378

    Hello!

    I’m trying to add an additional menu to my site. I’ve registered it in the functions.php file:

    function register_my_menu() {

    register_nav_menu(‘mobile-menu’,__( ‘Mobile Menu’ ));

    }

    add_action( ‘init’, ‘register_my_menu’ );

    And I’m using this code to call it in the header.php:

    <?php wp_nav_menu( array( ‘theme_location’ => ‘mobile-menu’, ‘container_class’ => ‘mobilemenu’ ) ); ?>

    However, several lines of this error gets outputted:

    Warning: Attempt to assign property of non-object in /…./wp-content/themes/broadscope/framework/php/class-megamenu.php on line 222

    What is the proper way to add additional menus to this theme?

    Thanks!

    Katie

    #115582

    1) In header.php replace:

    $args = array('fallback_cb' => 'avia_fallback_menu');

    with

    $args = array('theme_location' => 'avia', 'fallback_cb' => 'avia_fallback_menu');

    and (somewhere in header.php) add

    wp_nav_menu( array( 'theme_location' => 'avia2', 'container_class' => 'mobilemenu' ) );

    2) In functions.php replace:

    register_nav_menu('avia', THEMENAME.' Main Menu');

    with:

    register_nav_menu('avia', THEMENAME.' Main Menu');
    register_nav_menu('avia2', THEMENAME.' Mobile Menu');

    and in wp-contentthemesbroadscopeframeworkphpclass-megamenu.php replace:

    if(!isset($args->max_columns)) $args->max_columns = 5;

    with

    if(is_object($args) && !isset($args->max_columns)) $args->max_columns = 5;

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Register New Menus’ is closed to new replies.