WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: JQuery Mega Menu Widget] Multisite question (2 posts)

  1. fizzyfozzy
    Member
    Posted 1 year ago #

    I am using the JQuery Mega Menu Widget to show a multi-level navigation on the top-level site of my multi-site installation.

    I would like to display the same menu on all sub-sites of my multi-site installation but preferably without having to re-create the menu over and over again under each sub-domain.
    Is there anyway I can 'tweak' the code to tell the widget to use the custom menu on the top-level site?

    Maybe something using switch_to_blog(1); ???

    Thanks

  2. fizzyfozzy
    Member
    Posted 1 year ago #

    Ok, I've actually worked out a way around this now. Not ideal but I thought I'd post what I have done incase it helps anyone else. Or until someone can post a better solution.

    I have amended line 119 of dcwp_jquery_mega_menu_widget.php from:

    wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu, 'container' => false ) );

    to:

    switch_to_blog(1);
    wp_nav_menu( array( 'fallback_cb' => '', 'menu' => Shared-Primary-Navigation, 'container' => false ) );			restore_current_blog();

    This tells the widget to ignore the menu that is selected from the drop-down in the widget options and to switch to the main blog and use the menu named 'Shared Primary Navigation' instead.

    I then created a blank menu called 'dummy menu' in my sub-domain and I placed the widget into the widget area on my sub-domain as on the top-level but instead selected my dummy menu from the drop-down (still setting the correct style options etc).

    When i view the site the menu appears but it pulls in my top-level navigation. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic