Last week I entered into the WordPress development world to create a plugin that I personally had a real need for – better page hierarchy setup within WordPress.
If you have any experience with creating a CMS-type site with WordPress, you’ll know that setting up the navigation structure can be a tedious and time-consuming task – especially if the navigation is extensive with multiple levels! Nothing quite beats the ‘fun’ of manually editing each page to change both it’s Parent and Order attributes. Trust me, I’ve been there too many times!
What I wanted (and clearly needed) was a plugin that allowed me to quickly change the parent-child relationship between pages (the hierarchy) and at the same time be able to quickly shuffle the order they appeared.
There were a number of solutions out there, but in my opinion they call came up short. I wanted something to make this process as easy as possible, which is why I decided to create my own version.
WordPress Menu Order: The Plugin
This is a very simple plugin that relies on jQuery UI library for the core font-end functionality. The functionality was based exclusively on a script created by Dave McDermid, so I’m indebted to him for this. You can read more about this functionality in a blog post he wrote about it called: Building a sortable sitemap with jQuery UI.
Using this front-end functionality, you can drag pages defined within your WordPress installation and drop them to a desired location of your choosing. It really doesn’t get any more complicated than that.
Remember, this thing is still ‘beta’
Although some testing has been done, there are bound to be errors and glitches that popup, so be warned. Please leave me feedback on the plugin if there are any issues and if you’d like certain features added and/or improved.
Download the plugin
You can grab the plugin from the link below or it can be obtained from the official WordPress plugin gallery page.
Download the WordPress Menu Order (v1.0) plugin
The version on my server is now out of date, so please refer to the plugin directory on WordPress to ensure you have the latest working version.
This will only help me if I can use this system to “not include” pages that I do not want to appear in the navigation menu at the top of the page. Will this allow me to do that?
Jim, the plugin does not handle that aspect of the navigation. However, you can easily remove items from your navigation by adding a custom field to the pages you want displayed, and then filtering them by using the
wp_list_pagesfunction. This function has an attribute calledmeta_key, and if you set this to the value that you used when defining the custom field, it will include this page for output - excluding all other pages that do not have this custom field set.Continuing the idea:
Line 144:
post_title; ?>
In the template:
$mike_menu = mike_menu_function(); //return ‘include=3,5,4,7′
wp_list_pages($mike_menu);
Mike,
Great work!
This could be the best menu plugin ever for WP if you only add an option for making them visible in the menu (and a function calling the wp_list_pages() including just marked ones).
mike_menu();
Cristian, thanks for the comments
As of this time, I don’t intend to enhance the plugin (it was mainly built just to satisfy my annoyance for ordering pages around the old manual way.
Feel free to build onto this though, using your suggestions – it definitely sounds like a good idea!
How is this different than the PageMash plugin?
Philip: There’s not a whole lot different between this one and PageMash; however, one slight improvement that mine offers is that the navigation is updated ‘on-the-fly’ – no need to click a submit/update button after the menu is sorted. Mine sorts as soon as you ‘drop’ the selected page on the target.
great thanks a lot, will give it a shot in a few hours and let you know how it worked out.
hey mike I’m having the same problem as Huge, I’m using firefox 3.5.5 and my java scrip is enabled
Hi Tim,
The issue was fixed earlier today; you’ll need to download version 1.02. The prior version had a problem with the assets being in the wrong folder, so when I was calling them from the main plugin file, they were not being found.
Hi, I downloaded this and plugged it in because I needed something to ‘order’ my main navigation items (as it happens, pages – mine is a very CMS non-blog site)
Errr….can’t see what this plugin does!….??? When I clicked the WP Menu Order under pages I just get a list of my pages with Expand/Collapse above them. These links aren’t reactive (maybe because I have no child pages yet), but there was no way to “order” the main nav items…..which is surely the point of something called “menu order”!!!
So, how do I order my main menu items? Or is it back to the WP page order interface
rgds
Hugh
Hugh, it sounds like you don’t have JavaScript enabled in the browser you’re using. At this time, the plugin will only work if you have JavaScript enabled. What browser (and version) are you currently using?
If it turns out that you do have JavaScript enabled, then still let me know what version (and type) your browser is. I haven’t done a whole lot of extensive testing on this thing, so it wouldn’t surprise me if there were cases (such as yours) where it fails.
great plugin! thanks alot really appreciate your work…
Nice work mate, makes re-structuring much easier! Hopefully something like this will get picked up and integrated into wordpress properly.