GithubHelp home page GithubHelp logo

network-subsite-menu's Introduction

Network Subsite Menu

Posted in case anyone finds it useful. This is definitely a scratch your own niche (get it??) kind of plugin.

Basically, if you have a multisite and you want to create a global menu with some or all of your subsites and show which subsite you're on, this will help you build that menu.

To use it, Network Activate it and then go to Settings -> Network Menu.

You'll see a list of your subsites, with a checkbox to enable or disable that subsite in the menu. There is also a field to set the menu label.

Implementation

Once you've configured it, just drop this somewhere:

wp_nav_menu( array('menu' => 'network_subsite_menu') );

In reality, the plugin doesn't really use wp_nav_menu, so you're going to be pretty dissappointed if you try to pass other options. It's building out the menu manually, using the standard WordPress nav menu HTML and then circumventing the whole nav menu function by directly returning the output.

The only parameter that will work is echo.

Filters

If you need anything beyond the basics, these filters should get you there in theory:

cgd_network_subsite_menu_settings

Filter the whole settings object. You could change the order of menu items here.

cgd_network_subsite_menu_before

Lets you insert menu items before the main menu item loop.

cgd_network_subsite_menu_after

Lets you insert menu items after the main menu item loop.

cgd_network_subsite_menu_site_info

Filter the url, label, and set whether or not the current menu item is the current one.

To see how these actually work, look at the code dawg.

network-subsite-menu's People

Contributors

clifgriffin avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

m-e-h pbrocks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.