• Ok, I must be a complete dummy, but for some reason I can’t get the archives to be viewed through a drop-down list. I searched the support boards, I searched the Wiki, and from what I understand, the code I want needs to be:

    <?php get_archives('monthly','','option','','',false); ?>

    However, at first I was just getting “January” and no dropdown for it (there is only the one month), and now I am not getting anything at all. Could someone help explain this to me please? I did it once on my own blog (this is a test blog I am working on for someone else), and it worked, but I don’t remember exactly what I did.

    Thanks in advance!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter Valerie

    (@bunnygirl)

    Ok, I guess I would just like to know if anyone has their archives in a drop-down list, and how they got it to work.

    Thanks!

    Thread Starter Valerie

    (@bunnygirl)

    nevermind, I finally found it. Sorry!!

    bunnygirl, I was just wondering the same thing. could you share your solution?

    Thanks!

    Yes, please share! Thanks.

    Goes like this folks:

    <form name="archiveform" action="">
    <select name="archive_chrono" onchange="window.location = (document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);">
    <option value=''>Select Month</option><?php get_archives('monthly','','option','','',false); ?>
    </select>
    </form>

    Ah, works like a charm! Thanks for sharing!

    perfect, thanks so much!

    Okay, I too am trying to implement this. I copied the code from this thread completely as-is, and it worked perfectly. The thing is, I want to use a button in conjunction with the option menu, instead of an option immediately taking affect when selected. I assumed all I needed to do was move the “onchange” attribute to a button and change it to “onclick”, but for some reason it does not work.

    Here is my code:
    <form name="archiveform" action="">
    <select name="archive_chrono">
    <option value="">Select Month</option><?php get_archives("monthly","","option","","",false); ?>
    </select>
    <button type="submit" onclick="window.location = (document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);">Go</button>
    </form>

    If anyone could shed some light on this I would appreciate it.

    Uh, okay…

    That post you linked me to didn’t answer any part of my question. All you said was that there is absolutely no way to accomplish this without JavaScript (which I remain very skeptical of), and you mentioned a way to do this using a form button, but there’s no code to show it. Care to share that code here?

    And isn’t there already a plugin for categories that does exactly what I’m looking for, that doesn’t use JavaScript? Why can’t a plugin that’s identical to this be created for archives?

    You need to add the action (where to go – s/b index.php) and the method (get or post) to the form tag.

    Tg

    It still doesn’t work. When I select an option all it does is relocate me to the URL in the form action.

    Here’s my new code:
    <form name="archiveform" action="wp/index.php" method="post">
    <select name="archive_chrono">
    <option value="">Select Month</option><?php get_archives("monthly","","option","","",false); ?>
    </select>
    <button onclick="window.location = (document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);">Go</button>
    </form>

    Okay… I just replaced the button with a regular <input> button, and now it works. How does this make ANY sense? I was under the impression <button>’s were supposed to behave the exact same way as <input type=”button” />’s. Anyone have any ideas?

    EDIT: I tried using the <button> method again. This time using the type=”button” attribute, and now it behaves as it should. Weird.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Archives Drop-down’ is closed to new replies.