• As referenced here, I’m trying to create a links dropdown list. I have no idea what I’m doing. (“Little children shouldn’t play with guns,” comes to mind.) I wonder why this doesn’t work:

    <form name="menuform">
    <select name="menu3" style="width:150px; margin: 0px; font-family: Tahoma; font-size: 10px;" onChange="window.open(menuform.menu3.options[menuform.menu3.selectedIndex].value);return false;">
    <option value=''>Select Link</option>
    <?php wp_get_links(); ?>
    </select>
    </form>

Viewing 7 replies - 1 through 7 (of 7 total)
  • Because wp_get_links doesn’t output links in <option> form. You will have to create a new function to do that.

    Thread Starter pezastic

    (@pezastic)

    And how do I do that?

    Hi,
    I’don’t know if you like the way i used, but see at https://www.leparole.net/moods and try to click on the “link” item (and in the others, ade in the same way.
    If you like the solution, you find the code and the instructions
    here:
    https://www.scriptygoddess.com/archives/2003/01/16/showhide-anything/
    Anyway, cause links in WP are divided in subcategories, the graphic issue wasn’t perfect, so I made some modification to the second chunk of code present there.
    So, take the first one from the site of scriptygoddess (the onhe which goes between the “head” tags, but for the second, if you like, you can use this:
    ‘<!–scriptgoddes LINKS INIZIO–>
    <!– …. do not change the line below … –>
    <?
    $layernum++;
    if (!isset($jsenabled)) {
    ?>

    • <span id=”click<? echo $layernum; ?>”>,’#?jsenabled=no’);return false;”>
      <!– … do not change the line above … –>
      <?php _e(‘(+) Links’); ?>
      <!– …. do not change the line below … –>
      </span>
      <? } ?>
      <!– if users click on the link and it doesn’t work – the page will be refreshed with the block below showing –>
      <!– Below is layer that is shown when open –>
      <div id=”hide<? echo $layernum; ?>” <? if (!isset($jsenabled)) { ?> style=”display: none” <? } ?>>
      <!– … do not change above (can customize the line below) … –>
      ,0);return false;”>
      (-) Links

      <!–questa ??? la lista dei links–>
      <ul style=”font-size: 140%;”><BR>
      <?php get_links_list(); ?>

      <!– you can also copy this block (look for the next ******) and duplicate it ABOVE the text you’re hiding… that way people don’t have to scroll to “close” the block –>
      <!– ******* if duplicating copy to here and copy and paste above the text you’re hiding to allow for another link to close the block –>
      </div>

    • <!– … do not change the lines above … –>
      <!–<LI style=”font-family:georgia, times, serif; font-weight:bold;”>–>
      <!–scriptgoddes LINKS FINE–>’

    oops, i don’t know how to render code in this forum…. the one above is not correct (and sorry to all the users).
    If anyone explain me how to post it ?? i’d be glad to share with you
    Simone (Italy)

    I try again…..
    <!–scriptgoddes LINKS INIZIO–>
    <!– …. do not change the line below … –>
    <?
    $layernum++;
    if (!isset($jsenabled)) {
    ?>

    • <span id=”click<? echo $layernum; ?>”>,’#?jsenabled=no’);return false;”>
      <!– … do not change the line above … –>
      <?php _e(‘(+) Links’); ?>
      <!– …. do not change the line below … –>
      </span>
      <? } ?>
      <!– if users click on the link and it doesn’t work – the page will be refreshed with the block below showing –>
      <!– Below is layer that is shown when open –>
      <div id=”hide<? echo $layernum; ?>” <? if (!isset($jsenabled)) { ?> style=”display: none” <? } ?>>
      <!– … do not change above (can customize the line below) … –>
      ,0);return false;”>
      (-) Links

      <!–questa ??? la lista dei links–>
      <ul style=”font-size: 140%;”><BR>
      <?php get_links_list(); ?>

      <!– you can also copy this block (look for the next ******) and duplicate it ABOVE the text you’re hiding… that way people don’t have to scroll to “close” the block –>
      <!– ******* if duplicating copy to here and copy and paste above the text you’re hiding to allow for another link to close the block –>
      </div>

    • <!– … do not change the lines above … –>
      <!–scriptgoddes LINKS FINE–>

    I actually created a plugin to use get_links( ) in a drop down menu. I can’t recall if I used the same parameters as the original get_links( ). I may have taken out some of the parameters that I didn’t want to use for my plugin.
    Right now, the plugin can organize links by Category ID. You may also choose the order by which the links are organized (name, ID, URL, Description and random). You may also limit the number of links shown in the dropdown menu.
    I am using the plugin to organize two different categories of links (“Favorite Sites” and “WP Plugins – Thank you”) on my site.
    I don’t know if this is what you’re looking for but you are welcome to check out the plugin: https://typedby.com/archives/2004/06/14/drop-down-plugin-for-wp-links-manager/

    Any thought given to figuring out how to create seperate drop down for each link category, or at least in how to create subheads within the drop down list?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Links Dropdown’ is closed to new replies.