The MU forums have moved to WordPress.org

Editing and creating top level navigation menus (66 posts)

  1. lunabyte
    Member
    Posted 17 years ago #

    ** Update **

    Menu Plugin is about 80% complete. All the tough stuff is done (read as: backend).

    Remaining: Pulling the stuff out for display, in both a template tag and widget format, initial clean-up.

    Should move to testing sometime tomorrow afternoon (US).

  2. andrewbillits
    Member
    Posted 17 years ago #

    I can't say this for sure but from a few emails i've got a feeling that he's jumped the wpmu ship. At least for a while.

    It's kind funny, we always manage to keep about the same number of intelligent people around here. Lunabyte showed up just after drmike vanishes just as drmike showed up just after another user vanished (can't remember the user now).

  3. lunabyte
    Member
    Posted 17 years ago #

    Funny how it goes in cycles, huh?

  4. andrewbillits
    Member
    Posted 17 years ago #

    yep

  5. lunabyte
    Member
    Posted 17 years ago #

    Testing this plugin out at the moment.

    Worked fine on MU, then had to make a couple minor adjustments for WP (2.0.5 was the version I tested.)

    Got a couple <strike>suckers</strike> friends testing it out on their WP installs.

    Once it tests out OK, I'll clean up the source a bit and offer it up for testing.

  6. dizzy99
    Member
    Posted 17 years ago #

    woohooo

    Diz rubs hands and gleams :)

  7. lunabyte
    Member
    Posted 17 years ago #

    The only error I had reported was one of those darn redeclare headers errors. However, I can't reproduce it on any of my boxes, so I don't know. It was only one of the people that tested it for me, and the others didn't report any problems at all.

    So, I'll clean it up and pop it out for a try as an alpha package sometime later today.

  8. andrewbillits
    Member
    Posted 17 years ago #

    I've had that reported with a few of my plugins and each time it's been another plugin causing the problem.

  9. dizzy99
    Member
    Posted 17 years ago #

    I had that with some whitespace in a function i put in once. Can't remember why but removing the whitespace cured it.

  10. lunabyte
    Member
    Posted 17 years ago #

    That was my first thought, but it only occurred when adding/deleting a specific item. So I don't know. I guess we'll see what happens. It seems to have something to do with when wp_redirect is called after editing/adding/deleting. So it could be a plugin that was installed or something.

  11. lunabyte
    Member
    Posted 17 years ago #

    OK, I'm a day late and a dollar short on this one, but it's ready to go.

    I ripped out and moved some stuff around, and it's much happier now. Put it back to my test <strike>dummies</strike> buddies, and all reported it was fine.

    I cleaned it up a little bit, good enough for an alpha, and it's ready to package.

    I'll tar it up tomorrow sometime, and post a link to the relevant info.

  12. dizzy99
    Member
    Posted 17 years ago #

    woohoo, so excited :) Looking forward to it :)

  13. lunabyte
    Member
    Posted 17 years ago #

    I'll stick this in its own thread, once it has a few public tests under its belt.

    For now, for those following the thread and interested in giving it a quick spin:

    Get the Menu Management Plugin

    Tested on: MU 1.0, and WP 2.0.5 and 2.0.6

  14. dizzy99
    Member
    Posted 17 years ago #

    Wow it works great so far.

    I have only tried the widget option currently as i have yet to look at the template tags to see how to incorporate into a top navigation menu.

    One bug i've found is if you create a child item of a parent menu item it puts the child item at the bottom.

    So if for instance we have

    ABOUT
    ANOTHER TEST

    and we create a child of ABOUT it looks like

    ABOUT
    ANOTHER TEST
    --- CHILD

    when it should, in reality, be

    ABOUT
    --- CHILD
    ANOTHER TEST

  15. dizzy99
    Member
    Posted 17 years ago #

    Just had a chance to test out the template tag and it seems to be working very well.

    Checking for its installation is easy with a

    ' <?php if(function_exists('wg_get_menu')) { wg_get_menu(); } ?>'

    And to use both the wordpress function or this plugin if installed is quite simply a case of an if then routine.

    ' <?php if(function_exists('wg_get_menu')) { wg_get_menu(); } else {?>

      <?php
      if (is_home()) {$pg_li .="current_page_item";}
      ?>
      <li class="<?php echo $pg_li; ?>">" title="Home"><span>Home</span>
      <?php wp_list_page('depth=1&title_li=&exclude=143&sort_column=menu_order' ); ?>

    <?php } ?>'

    Excellent job :)

    One thing i did notice is that the new menu looses focus but i'm not sure if you can do anything about that.

    So if i was on an ABOUT US page using the built in wordpress function then the active menu is set to ABOUT US. However using your plugin it isn't.

    Its a hugely minor issue considering the unique flexibility your now offering.

    Can i assume menu_id 1 is always the very first category menu created ? If so i could update my themes to always check just for ID 1 within the function you provided for top site navigation as members won't have access to editing the templates direct.

    Great Job btw. The plugin is very easy to use and extremely handy :)

  16. lunabyte
    Member
    Posted 17 years ago #

    Is this in the actual page, or in the admin area?

    In order for "child" elements to work (and it only supports a single sub-level atm), they have to be ordered just like you want them to appear in the menu.

    So you should have order values like:

    ABOUT (0)
    --- CHILD (1)
    ANOTHER TEST (2)

    It would add another (umpteen queries) if for every parent item it ran another query to find the child items. So, I used the menu order method instead.

  17. lunabyte
    Member
    Posted 17 years ago #

    I know exactly what you mean on the focus issue D, but, considering that the menu doesn't know what the page slug is, or if it even has one, there wasn't much to do with it. It could probably check the entire uri though, and possibly set the active class for the css.

  18. dizzy99
    Member
    Posted 17 years ago #

    Ah i understand the sub menus now. Thanks for the explanation. I just assumed that sub menus took a new count on order, which is usual for that type of thing. But as long as it works, its no biggy although it did fox me somewhat to start :)

    I know what you mean about the page slug issue. I wonder if there's a solution. Posts and pages have ID's right ? Can we try and use that and pull the ID from the database and compare to the slug ? Just brainstorming.

    Mind you, if that's even achievable, it would increase the sql calls considerably i would imagine.

  19. lunabyte
    Member
    Posted 17 years ago #

    Exactly Diz. More trips to the db. It's bad enough (for me at least) to be adding another table to the db. I'd prefer to stick all the info in an option row, but there's just too much to keep track of, and it would make for an awful big row of data.

    I'll probably use the uri or something, and do a check on the string for setting an active class.

  20. lunabyte
    Member
    Posted 17 years ago #

    Took a quick peek and added in a simple if to check the link vs the current url, and if it matches, set classes accordingly (page_item current_page_item).

    Once some other kinks are noted, I'll update the package with this addition. Might be a couple of days, depending on issues flagged, but so far the only thing I know of that causes an issue is if (as you noted above) you don't order the items correctly, or if you add a sub-menu item under a sub-menu item (to make 3 levels total).

  21. dizzy99
    Member
    Posted 17 years ago #

    Hi Lunabyte sounds great. Is the new code up for testing ?

  22. lunabyte
    Member
    Posted 17 years ago #

    Once some other kinks are noted, I'll update the package with this addition. Might be a couple of days, depending on issues flagged, [...]

    Well, other than feedback from you, I haven't received any other complaints. So if that's still the case in 36 hours (~6pm local [GMT -6]), I'll bump the version a nudge and bring it about.

    For your effort in assisting though, if you want to try it out prior to that, drop me a line through my site and I'll send you the two updated files.

  23. lunabyte
    Member
    Posted 17 years ago #

    For the record, I added this to the "ideas" list for inclusion in WP at large.
    You can vote for it over at WordPress.

    ;)

  24. dizzy99
    Member
    Posted 17 years ago #

    Sorry Lunabyte i didn't see that part of your release strategy, i really should learn to read :)

    I've put a response up to your list of inclusion on WP as i think its certainly worth a consideration for inclusion. Its a one click, serves all approach to something that every website needs. Good menu management,

    I'll contact you via email for a sneaky beta :)

    And please understand i wasn't complaining at all, just offering constructive feedback. Please don't think me ungrateful, as you've done us proud :) I'd hate to think you thought i was ungrateful :) I'll be using it and i know my members will be when they sign too :)

    Outstanding work.

  25. lunabyte
    Member
    Posted 17 years ago #

    Oh no, D. No need to worry about criticism.

    You should have seen some of the comments at times on the last project I did. That was an entire site system with 1000's of users. Some of which were not nice at all.

    So little comments on something trivial like this isn't a biggie to me at all.

  26. dizzy99
    Member
    Posted 17 years ago #

    Great :0 Certainly wouldn't want to offend :)

  27. Ovidiu
    Member
    Posted 17 years ago #

    found a little bug in mm-admin.php:

    need to change:

    href="admin.php?page=menu-item" title="Add new menu item"

    to:
    href="admin.php?page=menu-items" title="Add new menu item"

    could this plugin be modified so that one can also choose from existing posts/pages/links to include in the menues ?

  28. lunabyte
    Member
    Posted 17 years ago #

    Item 1: Been fixed already, but thanks for helping. ;)

    Item 2: Technically, yes. However, the goal of the plugin was to provide an easy to use plugin with as little resource use as possible. While it might be nice to click a box and have it show up, pulling in all posts and pages for this would eat up more resources than I'm willing to add. It already kills me that I added a new table, and I'm looking to possible store the entire menu structure in an option instead. Of course then you have to deal with other factors, which can also pose problems.

    So, for now, it's paste/type in a link, give it a name, tell it which menu to be a part of, and you're done.

  29. Ovidiu
    Member
    Posted 17 years ago #

    Item 2: ok, fine for me, but please keep us updated on any progres on this plugin
    Item 1: you say it was fixed, but I just downloaded your last version from the link you gave where it still happened.

  30. lunabyte
    Member
    Posted 17 years ago #

    That's because the next release hasn't been released yet, as I described a few posts ago.

    (As a note, you can tell this because the version and filename are the same as you downloaded previously.)

About this Topic

  • Started 17 years ago by dizzy99
  • Latest reply from lunabyte