Re: Adding menu items to the admin bar
Wow, you really took this little project to heart, didn’t you? Thanks for investing so much time on it!
1. Didn’t realize the ul elements could cause problems but it works just fine without them (tested successfully on bp-default and child theme).
2. By wrapping wp_list_pages in ul elements, all pages aggregate under a top-level “Pages” nav item, with actual WP pages as subnav items and child pages as sub-subnavs as example below:
“Pages”
– Page 1 – – Page 1 child 1 – – Page 1 grandchild 1
– – – – – – – – – – – – – – – – – – – – – Page 1 grandchild 2
– – – – – – – – Page 1 child 2
– Page 2
By removing the “Pages” li element and wrapping the call to wp_list_pages in li elements, WP pages appear as top level, with child pages as subnavs. Creating a new page adds it to the nav as a top-level item, unless excluded (either entering the page ID manually in the code, or with “Exclude Pages” plugin). I prefer it this way, but the modified code could be included as an option in the plugin for those who prefer having all pages listed under a common heading, with instructions on where to change the heading label.
3. I get no errors with the new WP3.0 checks in place. I couldn’t figure out how to do that, but I see it was a rather simple if !function_exists call. Huh…
4. I left the top link name “Pages” in the wp_nav_menu calls for now. I have not tested this code on WP3.0 so don’t know if the menus will behave as in 2.9.2
I ran the code with modifications, both yours and mine, and it works brilliantly. Collaboration is a wonderful thing
Here’s my revision: http://pastebin.com/4U85PWrt
No word yet from WP about my plugin submission… still waiting. Got to get to work now, thanks again!