WP_Menu the WP_Widget for menu...

  1. Boulli


    It would be great to be able to create our own menu with plugin, as easily as widgets.
    Something like:

    class My_Menu extends WP_Menu {
    	public function __construct() {
    		// menu actual processes
     	public function form( $instance ) {
    		// outputs options form on admin: nav-menus.php, left
    	public function update( $new_instance, $old_instance ) {
    		// processes menu options to be saved
    	public function menu( $args, $instance ) {
    		// outputs the content of the menu: forms, tables, js, ...
    register_menu( 'My_Menu' );

    See a lite (useless) example here

    Imagine the possibilities.
    It make it easy for developers.
    Easy for user to add menu with various content.
    And easy if you change your theme.

    Posted: 5 years ago #
  2. Ipstenu (Mika Epstein)

    What purpose would this serve?

    You can make a menu already out of anything you want, so what information are you trying to add to a menu that you can't already do?

    I just don't see what problem this solves.

    Posted: 5 years ago #
  3. shazdeh


    This would be super useful for building mega menus, where you can create new menu types to include extra stuff in the navigation menu, not just links to pages.
    Also, it would be useful for a plugin that doesn't make static urls, instead it needs to run some code to produce the url. Good for more dynamic url generation, like how Joomla supports this.

    Posted: 5 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    3 Votes
  • Status

    This idea is under consideration