WordPress.org

Ready to get started?Download WordPress

Forums

Multisite aand Global Widget Menu using PHP? (4 posts)

  1. nycwolverine
    Member
    Posted 2 years ago #

    I've just installed wordpress and enabled multisite.

    Using the network wide menu plugin (http://wpmututorials.com/plugins/networkwide-menu/), I've been able to get the primary menu to display on all my sub-sites in the header position - hooray!

    Now I'm trying to achieve the same effect in my theme's footer through the four footer widget areas available to me.

    I don't believe a plugin exists to achieve this and my google research seems to indicate that it might not be possible to achieve the global menu effect in widgets.

    That said, I thought of a possible workaround that I'm hoping to get feedback on.

    In the main site I created several custom menu's. I then used the Custom Menu widget to display the menu items in each of the four footer widget areas.

    Now here is my idea. I installed the plugin "Linkable Title Html and Php Widget by PepLamb" (http://wordpress.org/extend/plugins/linkable-title-html-and-php-widget/) so that I could hopefully add php code that would retrieve the menu's from the main site. This way if I make changes in the custom menu's they will appear in all the subsites as well.

    In my subsites, I used the following code in the widget using the php plugin, which gave me a list of all the pages in my subsite. However, I am looking to have a list of the main site pages I listed in my custom menu in the main site.

    <?php wp_nav_menu('show_home=1&exclude=5,9,23&menu_class=page-navi&sort_column=menu_order'); ?>

    I'm not sure if there is a way to change some of the code above to retrieve the menu from the main site, but if there is, your help is greatly appreciated.

    Thank you.

  2. nycwolverine
    Member
    Posted 2 years ago #

    Thank you for the speedy response!

    I tried to follow the documentation and poked around a little in several of my themes php files and came up with this.

    <?php
    function mysite_footer() {
    	do_atomic( 'footer' );
    }
    add_action('wp_footer', 'mysite_footer');
    ?>

    I placed the above code in the "Linkable Title Html and Php Widget" area I have in my footer and I get a parse error.

    Seeing the error makes me think it obviously shouldn't go there.

    That said, where should it go? I don't think it goes in the footer.php file, but then again maybe I'm wrong.

    Thank you again.

  3. Start with something simpler.

    Try just putting in echo "<p>Footer</p>"; to see WHERE it's outputting, and work up from there.

Topic Closed

This topic has been closed to new replies.

About this Topic