Dropdown menu plugin

A couple of days ago, a friend of mine complained a bit about not being able to find a decent dropdown menu plugin. He did manage to find a solution, but then I had to tell him that you should really avoid editing the wordpress source code, and that all of this could be pluginized. He told me to go right ahead, so now I had to build a plugin with my big mouth. No problem. This plugin builds a css dropdown menu based on your page list. To get this thing to work do as follows:

  1. Unpack the contents of the zip to your plugin dir.
  2. Activate the plugin from your admin panel.
  3. In your theme's header.php, add the line <?php gdd_dropdown_menu('Site Home'); ?>. The 'Site Home' string is optional, it defaults to 'Home'.
  4. Admin your plugin through the 'Manage' menu (pretty self explainatory I hope)

That's it, it should work now. (it is beta, so it should work doesn't mean it actually does work, I've only tested it in Wordpress MU and Wordpress 2.0)

download version 0.3 (fix for the IE alignment issues, and the IE7 bug, still not compatible with WPMU)
download version 0.2 (Works with regular Wordpress only)
download version 0.1b (version without admin page, works in regular Wordpress and Wordpress MU)

Please note that the current version 0.2 is an in-between version, I'll start workin on a new version soon sometime maybe, wich probably won't be backwards compatible.

update: it has come to my attention that the dropdown menu doesn't always work well with ie7, so I've made another download for version 0.2, wich has a slightly altered csshover.htc file and a minor modification to the css file. I haven't tested this, but it's worth a try if you're having trouble with getting the plugin to work in ie7.

47 Responses to “Dropdown menu plugin”

  1. Joid

    Mag ik hier wederom een w00t deponeren?

    Heb je trouwens nog iets met CSS in deze plugin gedaan? Of moet dat apart?

    *zet 'm bovenaan in lijstje van uit te proberen plugins*

  2. Zoute snor

    CSS zit in de plugin, deze werkt dus redelijk OOB. Ik heb nog wel een verlanglijstje voor wat er nog meer in mag, maar dat komt later.

  3. Joid

    "He told me to go right ahead" Nee, er staat niet dat je rechtvooruit kon gaan. Er staat dat je mag uitleven!
    "Het told me to life myself out" zou dus beter zijn.

    *keeps Zoute (and his plugin) in teh holes*

    *or smiezen* FWIW

  4. Bas

    thanx! going to use it on my new site. works perfect

  5. Selvam

    I used Your Plugin in my website.The IE bug also resolved over there.Thanks for your Plugin...

  6. brecht

    van het moment ik

  7. Cathy

    Good morning! I like the plugin, thank you for developing it. However, I'm having a problem with the CSS in IE. I've downloaded and installed the patch for IE7, but unfortunately, it doesn't seem to be working in IE.

    I've got the drop down part working, as you can see from my site, but the placement is not working. The CSS shows that it should be positioned left, which it shows up as in Firefox. However, in IE, it is all the way over to the right. Additionally, before I changed the padding, the navigation links were off the right edge of the page.

    Is there a quick fix for this? As I said, other than the placement on the navigation bar, the plugin works perfectly.

    Thanks!
    Cathy

  8. Simon

    Hi Cathy, you could edit the plugin and get rid of the table/tr/td tags, it might do the trick.

  9. Valerie

    Thank you very much for providing a solution I've been wanting for a very long time!

  10. Mark Rabideau

    Hello,

    I have cleaned up the CSS on this very nice plugin. If you'd like me to send the revised code, I will be happy to do that. SImply drop me an email.

    Regards,
    ...mark

  11. Therese

    Hello,

    I have installed the dropdown menus in wordpress, and it works great. My only issue is that the menus only display when I hover. I would like the menu to display always, and just the sub navigation to display when I hover.

    How can I do this?

    Thanks In advance,

    Therese

  12. Therese

    I figured out my issue, I could not see the nav bar without the hover because the text was white on a white background. Silly me!

    I love this dropdown menu!

    Therese

  13. Simon

    Thanks for all the comments while I was away being busy.

    @Mark: I'm really not currently developing this plugin any further, if you'd like to do so, be my guest. I'm just too busy with other projects.

  14. Leo

    Hey I just wanted to say that I have used your plugin and that it is great.
    I had to adjust the css slightly but as far as I am aware it is working perfectly now.
    Thanks for such a great plugin

  15. Cathy

    Simon, I tried the fix you suggested, but it broke the blog. If I recall, I got a blank screen. Perhaps I didn't edit it correctly, but I believe I took out the proper parts.

    I've left the navigation bar alone since November because I didn't want to add any other pages. However, now I would like to, and I realize I need to fix this problem.

    Knowing my luck, the problem is unique to my blog and conventional fixes won't solve it. However, just in case, I thought I would ask if you have any other suggestions?

    Thanks!

    Cathy

  16. Simon

    Cathy,

    Actually, the problem you're having isn't unique to your blog, I've seen it on multiple occasions. So I've made one more update on the plugin, downloadable here. Please test this to see if it works, it did on this site.

  17. Cathy

    Bummer! I tried version 0.3. It worked on Firefox, but the menu disappeared completely in Explorer.

  18. Simon

    Well, you could edit the main plugin file and delete the & #160; (without the space between the & and #) bit near the end. But this really is the same version as the one running on this site, so it should work. (unless the menu on this site doesn't work on your machine either)

  19. Rebecca

    I would like to only list the child pages on the home menu bar. currently I have:

    but when i put it in the custom menu file, nothing appears. Is it possible to only list children pages of a single parent?

  20. Ashiado

    wow... this is exactly what i have been looking for. Still need to adjust the css (it's all off because i'm applying this to a site design after the fact), and to be fair I haven't browser tested yet, but it looks like the basics are there. re: Cathy's problem, I actually had a similar issue with another site not using your plugin and what fixed it was adjusting the css position and z-index attributes. might be worth a try anyway. This could explain the site-specific/not generic nature of the problem.

  21. Simon

    Rebecca: Well, you could edit the core files of the plugin, or don't use the gdd_dropdown_menu() command, but instead use some code like this:

    <div id="dropdownmenu">
    <ul><li class="page_item"><a href="/" title="home">Home</a></li>
    <?php wp_list_pages('sort_column=menu_order&title_li='); ?>
    <?php wp_register('<li class="admintab">','</li>'); ?>
    </ul>
     
    </div>
    
  22. kjell

    Hi,

    I'd place the admin menu for this under presentation. If there's a new version :-)

  23. Harry Love

    This is a fantastic plugin!

    One problem: I am a PHP and CSS amateur and am having trouble figuring out the dropdown_style.css file completely.

    More specifically, I am having trouble figuring out placement of the actaul dropdown windows for each page item (they are all on the far left, I would like them to be under each item).

    Also, I am having a little trouble with the padding around the page items in the main menu (the ones that have dropdown menus change size slightly) and also with the colors.

    Anybody have a CSS file that has a describing notes in it that could help me out?

    Thanks in advance.

    discordian.princess@shaw.ca

  24. Mark Rabideau

    I have published my revised css modified version at:

    http://wordpresshelp.org

    On the Downloads page. Enjoy!

    ...mark

  25. rmaspero

    I love the menu sytem but they seem not to work in IE6 and IE7?? can you help me??

  26. Simon

    rmaspero: I really don't have a clue why this doesn't work on your site, sorry. Maybe it doesn't work well with another plugin, but you're pretty much on your own with this problem.

  27. Travis

    I love the plug in but I just can't seem to get it to work on my site. I have been up all night trying to figure it out but can seem to. I have been putting the code in my header.php file but the pages duplicate and they are all jambled on top of each other. Don't know what to do. Any suggestion would be great thanks.

  28. Simon

    Travis, looks like you're first calling the wordpress function wp_list_pages(), followed by the gdd_dropdown_menu() part, so your getting two menu's on top of each other. Try removing the wp_list_pages part.

  29. Travis

    I deleted the wp_list_pages but I am still getting having an issue with the site admin and the alignment. Any suggestions would be greatly appreciated. thanks

    Travis

  30. Frank

    I love dropdown plugin. Best one on the web. I am having an issue with getting the dropdown css to validate. I get this error when I run the w3c css validate tool on the site sundaysalon.com:

    Property behavior doesn't exist : url("http://www.sundaysalon.com/wp-content/plugins/drop-down-menu/csshover.htc")

    Not sure how to fix it so it validates. It's the only thing keeping my css from validating. Any help would be appreciated.

  31. Frank

    On the question of the menus shifting in IE, I've found this hack to be moderately successful.
    The first CSS group only IE7 sees, the second set only IE6 and below sees and the last is for Firefox and other browsers. Adjust the margin to fit your needs.
    -----------------------
    *:first-child+html
    #dropdownmenu li ul {
    width: 150px;
    height: auto;
    top: 100%;
    margin:0 0 0 -70px;
    padding:0px;
    }

    * html
    #dropdownmenu li ul {
    width: 150px;
    height: auto;
    top: 100%;
    margin:0 0 0 -70px;
    padding:0px;
    }

    #dropdownmenu li ul {
    width: 150px;
    height: auto;
    top: 100%;
    margin:0px;
    padding:0px;
    }

  32. Peter

    Hi~ How do I hide/exclude a page's ID (with dropdown menu)

  33. Simon

    Peter, inside the dropdown_menu.php file is a line wich goes wp_list_pages('sort_column=menu_order&title_li=');, this is a native WordPress function, you can edit this to exclude certain pages, see here.

  34. Mark

    Hi Simon,

    I've used your fantastic plugin on a few sites now, but I have one client with a question which I haven't been able to implement.

    The client would like the links to be active across the whole "hover" area, instead of just the actual text part of the link.

    I have tried editing the CSS to achieve this, but have been unsuccessful after quite a number of hours.

    Can you, or anyone else reading, find a suitable solution to this?

    Many thanks in advance,
    Mark.

  35. Simon

    Mark, I don't really see how this can be done using this plugin. This is because the hover area actually is an area defined by li-tags, in this area the actual link is nested, like this:

    <li class="page_item"><a href="ht...

    To achieve what you want I would probably replave the link tekst with an image, so you can define the exact size of the link area.

    Hope this makes sence to you.

  36. Mark

    Hi Simon,
    Thanks for your reply. I found another drop-down plugin which provides this function, so I will implement that one instead.

    http://www.zackdesign.biz/wp-plugins/42

    Using images wouldn't really work in this case because I need to keep the menu dynamic.

    Kind regards,
    Mark.

  37. Randy

    Thanks for the plugin! It works extremely well.

    For those who install wordpress in a directory on their server but have the blog served from a different directory (such as from the root directory as described here: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory )

    I believe there is a bug that you need to fix. Update your dropdown_menu.php file as follows.

    OLD:
    function gdd_dropdown_menu($home='Home') {
    $gdd_wp_url = get_bloginfo('wpurl') . "/";

    NEW:
    function gdd_dropdown_menu($home='Home') {
    $gdd_wp_url = get_bloginfo('home') . "/";

    Thanks,
    Randy

  38. Midas

    Ik ben beginneling met wordpress, probeer een dropdown menu er in te krijgen, maar krijg niet meer dan een lijst zie mijn site; http://www.huisartsenhulp.nl/, waarschijnlijk doe ik iets fout, misschien kan iemand snel aangeven waar het mis gaat.

  39. Simon

    Hij doet het hier gewoon Midas, alleen de plaatsing is niet helemaal goed.

Trackbacks

Leave a Reply