WordPress plugin: Zelig Dropdown Links

This plugin is similar to the Zelig dropdown cats one, and it’s also an answer to some requests of my readers.

It displays the links in the sidebar as a simple dropdown list (select box). If you have more link categories, every one will be shown in it’s own list.
This is supposed to replace the original get_links_list() function and should be useful if you have a lot of links, but you don’t want to clutter up your sidebar with them!

INSTRUCTIONS:

  1. Download the zip file containing the plugin. There are two versions, both with equal functionality, to choose depending on the WordPress version you are using:
    Zelig Dropdown Links 1.2 – For WP 2.1 (and following, I hope…);
    Zelig Dropdown Links 1.1 – For previous WP versions.
  2. Extract the zelig-dropdown-links.php file into the plugins directory in your WordPress installation (wp-content/plugins).
  3. Log in to WordPress administration. Go to the Plugins page and Activate this plugin.
  4. Put this code somewere in your template page, outside the loop (usually in sidebar):
<?php zelig_dropdown_links(); ?>

The zelig_dropdown_links() function has some parameters you can pass (please note that options syntax is changed from version 1.0):

Parameter Values Description Default
boxwidth number width size (in pixel) of the list box. If you don’t use this parameter or if you set it to 0, the list box will assume the width of the longest category name it contains. If you set a width value, longer names may be truncated at that point, depending on browser (IE6…) 0
exclude number or comma separated list of numbers link category or categories (ID numbers) to hide. If not set or set to 0, all link categories will be displayed. 0
include number or comma separated list of numbers link category or categories (ID numbers) to display. If not set or set to 0, all link categories will be displayed. 0
title 0
1
set to 0 if you don’t want the first row of the list as a title with the name of the link category (text appearing in the list box when it’s closed). 1

EXAMPLES:

<?php zelig_dropdown_links('boxwidth=120'); ?>

Set the width of the list to 120 pixels.

<?php zelig_dropdown_links('boxwidth=120&exclude=1'); ?>

Set the width of the list to 120 pixels and hide link category with ID 1.

<?php zelig_dropdown_links('boxwidth=120&exclude=1,2,3'); ?>

Set the width of the list to 120 pixels and hide link categories with ID 1, 2 and 3.

<?php zelig_dropdown_links('include=1&title=0'); ?>

Displays only link category with ID 1 and without the category name as a list “title”.

This plugin, due to the peculiarity of the type of visualization, ignores a lot of elements of WordPress links, like image, description, score, target and rel. Only URI, name, visibility, sorting type and category limit are used.

NOTES:

You can use more than one istance of the function in the same page (provided that not showing the same links).
The output code is valid XHTML Strict.
Tested with WordPress from 2.0.4 to 2.1 only.

CHANGE LOG:

  • Version 1.2 (february 16, 2007): WordPress 2.1 compatibile.
  • Version 1.1 (january 17, 2007): added “exclude”, “include” and “title” options.
Informatica, Permalink

Abbiamo 70 commenti a questo articolo

  1. moieu dice:

    Hi,

    I installed your lovely plugin “dropdown” :thumbup: but I tried to exclude a category but it did not work I included the line as:

    Is that correct? If not how can I do it?Thus, I am using links dropdown plugin.

    Last request, where can I find an archieve dropdown plugin?

  2. moieu dice:

    Another question :twisted:

    How can I delete the old links lists from the sidebar?

  3. Zelig dice:

    Moieu, I supose in your first question you’re talking about my “dropdown cats” plugin, not this one, right? Anyway, I can’t see the code line in your comment, so maybe it’s better if you write me an email
    About archives, you don’t need a plugin: just use this code.
    About old links, just delete the line with the get_links_list() function call from the sidebar.php file.

  4. jayne dArcy dice:

    Zelig, this is terrific! Now I can use WP’s internal link system and not have to beat my head in over their screwey styling (which always messes up my themes). You’re positively brilliant!

  5. Lois dice:

    I placed it on my sie and keep getting an error. I would appreciate if you could have lok. Thanks

  6. Zelig dice:

    Lois, I can’t see any error on your site at present (but I suppose you’ve disabled this plugin). Please explain me better your problem, if you still need help!

  7. Shine dice:

    Hi there,

    The exact widget I was looking for… Had some trouble as I put the code in without the boxwidth option and for some reason my blog wanted it to have it.. so lucky I thought to try it with it in!
    My question… can I modify it to open the links in a new window?

    Thanks,
    Shine

  8. Zelig dice:

    @Shine: it is possible to modify the code to have the links opened in a new window, but I don’t recommend it because you can have some problems with that: for example, some “popup-stopper” could block it and Mozilla Firefox opens it in a new instance rather than in a new tab.
    Anyway, maybe I’ll add this option in future releases and let people choose!

  9. Francesco dice:

    Davvero tnx ho trovato il codice rieditato ed ora è valid XHTML
    finalmente trovo qlc che gli interessa e crede nella filosofia di fare pagine compatibili con tutti i browser e veloci da caricare ecc anche se il discorso è molto piu’ lungo
    ciau

  10. Zelig dice:

    Io sono un maniaco della validazione! :lol:

  11. zoneX dice:

    Anch’io :wall:
    ma passando al serio ‘ veramente positivo farlo.
    Solide basi e accessibilità molto piu’ facile per tutti.
    Per non parlare della banda risparmiata
    ciao:whistle:

  12. michael lines dice:

    Sorry to be so dense, but I cannot find a “template” file. I found something called “templates” in the wp-admin folder, but adding your text has no effect… it may help me to know what you mean by “outsid e the loop (usually in the sidebar)”. My sidebar has its own file….
    Thanks for any help.

  13. Zelig dice:

    You’re on the right way, michael. There’s not a template file, but template folders. Just edit your sidebar.php file in that folder and add the required code.

  14. Elyse dice:

    Zelig -

    I LOVE this plugin!:thumbup: I am currently helping a friend with her blog and she is utilizing the WP Link Manager and has five different link categories. Is there a way to have it only pull up one Link Category at a time? If you look at the site you’ll see the right nav has image headers for each link category and I’d like to have a separete drop down for each.

    Thanks in advanced!
    Elyse:mrgreen:

  15. Zelig dice:

    @Elyse: no way at present, sorry. Maybe next version…

  16. elena dice:

    Ciao, volevo chiederti… avendo più categorie di links…c’è modo di far affiancare le diverse tendine in orizzontale invece che metterle una sotto l’altra? (vorrei inserirli non nella sidebar ma nel footer)
    grazie :)
    elena

  17. Zelig dice:

    Elena, ho pravato a pasticciare un po’ con i CSS e anche con il codice del plugin, ma non ci sono riuscito nemmeno io, mi dispiace… :(
    Magari quando mi capita un po’ più di tempo libero ci torno sopra con più calma.

  18. Dave dice:

    Hi, any chance of adding ability to exclude link categories, and also to sort by name? I have links that I only want to appear on inside pages. I can call them there with wp_get_linksbyname. But I would like to exclude them on the home page where I use the dropdown.
    Thanks for both dropdown plugins.

  19. Adrian dice:

    this plugins is great!
    i use it for my blog and it’s working just like what i want
    thanks brother!

  20. Zelig dice:

    Rilasciata una nuova versione del plugin (1.1)
    Plugin’s new version released (1.1)

    This should help Elise, Elena and Dave, I hope! ;-)

  21. Dave dice:

    Bravo!! With the combination of include and exclude, I can control what goes where and the order. This is perfect. Thank you again.:cheers:

  22. Pingback: Soporte-Wordpress

  23. Peter dice:

    Hi,
    Is this compatible with WordPress v 2.1? I am running 2.1 RC2 and I get some sql error about wrong table being requested for the links.
    Any help will be appreciated.
    Thanks,
    Peter

  24. Adrian dice:

    unfortunately this plugins doesn’t works in wordpress 2.1
    i love this plugins and i’m waiting a new release that works on wp 2.1
    sorry about my english brother! :wall:

  25. Zelig dice:

    I’m still running 2.0.7, so I’m not tested it yet…
    I’m sorry for the problem, as soon as I’ll upgrade my WP setup, I’ll try to fix it.

  26. Michael dice:

    I’ve put your plugin on the list Plugins that don’t work at the WordPress Codex. Please remove it when you get it running in 2.1. Thanks.

  27. Zelig dice:

    Still no time to work on the plugin, but meanwhile it seems than someone did the job for me! Look here (if you can’t wait…).

  28. Klaus dice:

    Hi, any chance that I can change the background color and the color for the drop-down sign ?
    Klaus

  29. Zelig dice:

    Yes, Klaus. You can do it with CSS, as explained in this comment (it refers to another plugin, but it’s the same thing here)

  30. Klaus dice:

    Hi, the background color is changed. The only thing is, it seems to be impossible to change the buttom color ???

    rgds
    Klaus

  31. Klaus dice:

    Hi again, sorry I’m nearly a “dummy ” concerning CSS. Please have a look at http://www.m-etropolis.com My stylesheet looks like this: #sidebar select {
    background-color: #a9ac99;
    font-family: ‘Trebuchet MS’, ‘Bitstream Vera Sans’, Verdana, Arial, ‘Lucida Sans’, ‘Lucida Sans Unicode’, Helvetica, sans-serif;
    border: none;

    What I would like to chnage in addition is the bottom color background into white, the little blue arrow into black and the hover color into white. I’m using only 3 colors on my page, like: black, white and grey. Would be very kind of you, if you tell me how to do this.

    Klaus

  32. saurabh dice:

    Dear Mr. Zelig,

    As per your instructions, i have successfully installed the “drop down links” in the plugins admin menu panel. After activating the plugin, i have no idea what to do next.

    I am relatively new to wordpress environment & would like a step by step description of how to go ahead, in order to implement the desired change in the blog (blogroll-links).

    I am using wordpress 2.1 currently. Kindly guide me, please.

    Thanks
    Saurabh

  33. Zelig dice:

    Rilasciata una nuova versione del plugin (1.2) compatibile con WP 2.1.
    Plugin’s new version released (1.2) compatible with WordPress 2.1!

    @Klaus: I don’t think i’t possible to do what you want (or at least I don’t know how…)

    @Saurabh: first you have to download version 1.2 of the plugin. Unzip and activate it. Now go to Edit > File in your admin panel and open the “sidebar.php” file of your template, typing the name in the box at the bottom of the screen. Supposing you are using the default theme, you must write “/wp-content/themes/default/sidebar.php” (if you are using another template, change “default” with the correct folder name). Look at the code and find the row that calls the function get_links_list(). Delete that row and replace it with the zelig dropdown links code.

  34. Adrian dice:

    The latest version of this plugins is workingjust fine in wp 2.1!

    Thanks Brother! :clap:

  35. Heathe dice:

    Is there anyway to use this for external links? I’d like the same functionality but allow for external links as well. Any suggestions?

  36. Zelig dice:

    Heathe, this plugin IS for external links. What do you mean?

  37. Heathe dice:

    I thought this was only for posts within a category. I need aomething that will allow me to manually input links that are outside my own blog.

  38. Zelig dice:

    New to WordPress, Heathe? :D
    You enter your external links as usual in your WP admin panel, then you can use this plugin to display them as a dropdown list instead of the default way.

  39. selcuk dice:

    hi zelig ,ı used your plugin.very useful but when user change page.plugin is change side,ı put to code inside sidebar.php,please check out.ı couldnt anything.
    thanks anyway:D

  40. Zelig dice:

    It seems OK to me, Selcuk.

  41. Adrian dice:

    Corrado, I made a widget version of this plugins.

    Forgive me if I post this plugins without your permission. I Hope you like it too. :pray:

  42. Zelig dice:

    No problem, Adrian. :thumbup:

  43. Carl dice:

    Great plugin, exactly what I was looking for. Just curious however, is there a way to display the link’s description?

  44. Zelig dice:

    No way, Carl, descriptions are ignored.

  45. Hi Zelig

    Thanks for your plugin. I installed it on my site (WP 2.1) and it works, but there’s a small bug. If you click a link and then navigate back to my site, the name of the link stays visible, instead of the category. Also, the link doesn’t work if you try to click it again. Is this the problem that was fixed at zazamataz.com?

    Also, if I make a list of previous posts that I want people to read, is there a dropdown that could show these posts?

  46. Zelig dice:

    Sorry Bock, no time to check and test at present. :(
    I’ll do ASAP and I’ll let you know.

  47. BG! dice:

    I’ve been trying to get this to work with the Redoable 1.2 theme and WP2.2 but it won’t work. Any ideas?

  48. Zelig dice:

    I don’t know that theme and I don’t use WP 2.2, so I’m sorry, BG… :-(

  49. Opinion8ted dice:

    I like to dropdown links, except for one thing. Some of my blogroll include the target=”blank” instruction to bring up the page in a new tab/window. These links don’t behave this way in generated select code. Would it be possible to make it do so? (or is bringing up new pages such a rude idea that I shouldn’t do it at all).

    TIA

    Jim

  50. Zelig dice:

    Sorry Jim, but as said, “target” option is ignored by this plugin.

  51. Jen Leheny dice:

    Great plugin – I would really like to have the links open in a new window/tab. You say above:
    @Shine: it is possible to modify the code to have the links opened in a new window, but I don’t recommend it because you can have some problems with that: for example, some “popup-stopper” could block it and Mozilla Firefox opens it in a new instance rather than in a new tab.

    If it is possible then please provide the code change to let us know how to get this happening. :)

    Jen

  52. Riri Audiya dice:

    really nice plugin..

    cheers up! =)

  53. baron dice:

    hi there.com plugin but :

    Does anybody know if tis script is compatible with WordPress 2.5?

    Thanks in advance for any help on this!

    turkbaron

  54. baron dice:

    hi. Thanks for plugin

    perfect…

  55. ryan dice:

    Thanks for this plugin – very nice. Like others, I’d really appreciate knowing how I can modify the code to open the links in a new window (despite the problems you mention).

    Baron – yes, it works in WP2.5. The (very) minor bug Bock the Robber mentions is still present tho.

  56. Zelig dice:

    I apologize for my late answer. I still have no time for programming and the only PC I can use is the one at office, but you know…

    So, to open links in a new window, if you really want, you can TRY this (and I say “try” because I’ve not tested it a lot, and i did it with version 1.1 only of the plugin…):

    Find the row with the code that says:

    echo '<p><select name="archive_chrono" onchange="window.location=(document.forms.linkform' . $cat['link_category'] . '.archive_chrono[document.forms.linkform' . $cat['link_category'] . '.archive_chrono.selectedIndex].value);"' . $boxlimit. "\n";

    or

    echo '<p><select name="archive_chrono" onchange="window.location=(document.forms.linkform' . $cat->cat_ID . '.archive_chrono[document.forms.linkform' . $cat->cat_ID . '.archive_chrono.selectedIndex].value);"' . $boxlimit. "\n";

    (for version 1.2)

    and replace it with this one (just copy & paste):

    echo '<p><select name="archive_chrono" onchange="ob=this.form.archive_chrono;window.open(ob.options[ob.selectedIndex].value)"' . $boxlimit . "\n";

    About the other bug you mention, I still don’t have a solution, sorry.

  57. ryan dice:

    Superb. That does the trick – very many thanks for the extra code to open the links in a new window. :thumbup:

  58. hi Zelig. Thanks for this cool plugin. I do have a minor bit of a problem. I just pasted the “” on the top of the sidebar script and it already showed in my sidebar. now the problem is that it exceeds the space of my sidebar to the left and i cant seem to make it stay inside. can you please take a look and see if there is anything you can help out with?

    i very much appreciate any help. thanks a lot and more power to you!

  59. oh btw, the site is http://www.borskinai.com
    its on the top of my first sidebar..

  60. Zelig dice:

    Borski, I looked – very quickly… – at the source code of your page and I’ve found that you open 2 times the DIV “sidebar”, one before my plugin and one after. Maybe the problem is there? :think:

  61. PNOOZ dice:

    Very elegant solution to a link mess. I just installed with your “open in new window” snippet and it worked beautifully right out of the box. Thanks!

  62. Pingback: Google, SEO ve Webmaster Blog

  63. David dice:

    Would it be possible for you to offer an update to this GREAT plugin which uses the WordPress “target” option? I have all my links set to “target=’_blank’” in the WordPress Admin UI, but they don’t open a new tab or window.

    And just so you know: the behavior of a browser with a ‘_blank’ target is usually controlled in preferences. FF can be set to open in a new tab or in a new window (instance).

  64. David dice:

    D’OH! Just saw the hack code above. And… IT WORKS on WordPress 2.7.1! Congrats on “forward-compatible” code; and thanks!

  65. Pingback: 200 WordPress Plugin List, 200 Wordpress Eklentisi | Hasan Yordana

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *

:smile: :grin: :mrgreen: :wink: :neutral: :sad: :cry: :eek: :confused: :cool: :lol: :razz: :oops: :mad: :evil: :twisted: :roll: :surprised: :!: :?: :idea: :arrow: :clap: :dance: :doh: :drool: :eh: :hand: :liar: :naughty: :pray: :shhh: :shifty: :sick: :silenced: :snooty: :think: :wall: :whistle: :love: :censored: :crazy: :food: :thumbup: :ciao: :cheers: :winky: :kiss: :rotfl: :ninja: