WordPress.org

Ready to get started?Download WordPress

Forums

Dropdown Archives (11 posts)

  1. carthik
    Member
    Posted 10 years ago #

    Hi,
    I was looking around after 2 hours of pottering around with code, trying to get a dropdown archive thingy set up on my webpage, carthik.net.
    The wp archives templates tells me that the format=option parameter will give me a list that can be within a dropdown menu.
    Can someone please please write me a small menu which uses this method? I can't get this done for the life of me.
    How is the format = 'option' supposed to be used to generate dropdown menus?
    I found an earlier thread with a hack that does not work now.
    All the hack gives me is "january 2004" as the first and last option :)
    All help leads to good karma :)

  2. carthik
    Member
    Posted 10 years ago #

    I found something at mrxss.com which does what I want...
    but that uses javascript , I guess...isn't that a bad thing, if someone doesn't have javascript enabled?

  3. danithew
    Member
    Posted 10 years ago #

    I'd be interested in reading an answer to 2fargon's question, whether this code at mrxss.com is the way to go for a dropdown archives menu.

  4. carthik
    Member
    Posted 10 years ago #

    I now use this on my blog..

    <li id="archives">Archives:

    <ul>

    <li><a href=""<?php">/narchives.php">Categorized, sortable archives</a></li>

    <li><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=''>By Month</option>
    <?php get_archives('','','option', 1); ?>
    </select>
    </form></li>

    </ul>

    </li>

    Adapt it to your use. I posted the entire archives ul, only part of it is used for the dropdown archives.

  5. karan
    Member
    Posted 10 years ago #

    I played around with that but I couldn't get it to work with WP 1.2, until I started digging into the actual function code...
    this is what works for me:

    <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=''>By Month</option>
    <?php wp_get_archives('format=option'); ?>
    </select>
    </form>

  6. mog
    Member
    Posted 10 years ago #

    Works perfectly for me. thanks.

  7. cb1977
    Member
    Posted 10 years ago #

    Put it into my code and it works great. Now how would I change it so display archives by category?
    p.s. Sorry for the novice question.

  8. Kevin
    Member
    Posted 10 years ago #

    This is what I use and it works for me. Grabbed it off the forums here the other day.
    <li id="categories"><?php _e('Categories:'); ?>

    <ul>
    <form name="catform" onchange="window.location = 'index.php?cat='+(document.forms.catform.cat[document.forms.catform.cat.selectedIndex].value);">
    <?php dropdown_cats(); ?>
    </select>
    </form>
    </ul>
    </li>

  9. steadyvibe
    Member
    Posted 8 years ago #

    Is that supposed to show the archives of a specific category? It does not work for me?

  10. samsarin
    Member
    Posted 7 years ago #

    I recently posted an article that explores in depth a method for adding drop down archives both by date and by category. It also includes support for hierarchical categories and includes javascript redirection. The article can be found here: http://samsarin.com/2006/07/28/dropdown-archives-in-wordpress/.

  11. immaterial
    Member
    Posted 7 years ago #

    kpont, I tried out your code and it works for me. Since I don't know much about php I'd like to know how to bring back the article quantity for each category and show it in my dropdown menu.

    As well, I'd like to know how to put an information in the first line of the dropdown menu, so that it is shown as long as the menu is idle, like, for example "choose category".

    Last but not least, how do I change the code so that it shows the archives instead of categories.

    Merci a lot.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.