• 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 ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter carthik

    (@carthik)

    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?

    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.

    Thread Starter carthik

    (@carthik)

    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.

    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>

    Works perfectly for me. thanks.

    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.

    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>

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

    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: https://samsarin.com/2006/07/28/dropdown-archives-in-wordpress/.

    immaterial

    (@immaterial)

    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.

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