Support » Fixing WordPress » using an html selector to choose which bookmarks category to show.

  • Hi all:

    i have a bunch of bookmarks organized into categories and i can manage to show them on my site, however, i would like to be able to choose which link category i want to see via an html drop down selector.

    i am guessing the html would be somthing along :

    <select name="chooser">
    <option value="category1">first category</option>
    </select>

    how do i pass the option value to the function’s argument?

    Saludos..

Viewing 1 replies (of 1 total)
  • how do i pass the option value to the function’s argument?

    If by “function” you mean a PHP function, you can’t. To do something like this, you need javascript (or ajax, if you’re in the mood).

    Here’s a general suggestion of how you might do it. This suggestion uses only javascript, not ajax, so it’s easier to do but less efficient for your visitors.

    First, edit your sidebar so that all your link categories display when you first load the blog, with each category wrapped in a separate div. Each div should have a unique ID.

    Next, use javascript to immediately hide all but one of the divs right after the page loads.

    Then, use the onchange event with your select tag to trigger javascript whenever somebody changes the selection.

    Finally, create the corresponding javascript function that will toggle link category visibility using the div ids.

    That’s just the general idea. You would need to do a bit of googling if you needed a javascript tutorial.

    But first, you may want to check the plugins repository and see if there’s not something like this already. I’m not aware of anything, but you never know.

Viewing 1 replies (of 1 total)
  • The topic ‘using an html selector to choose which bookmarks category to show.’ is closed to new replies.