Support » Fixing WordPress » archives dropdown menu

  • What kind of code do I need to enter into index.php to get a dropdown archives menu instead of a list? I’ve been looking around and seen a few possibilities. 2fargon raised a question some time ago about some index.php code that would also involve javascript.

Viewing 15 replies - 1 through 15 (of 29 total)
  • This is the code that I use on my site:
    <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>

    See the output on my blog, and change it as desired.

    You rock 2fargone!!!!

    Hmm.. Is it possible to adapt this for the Categories? I used the following, but the result was.. >.<

    • <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</option>
      <?php get_cats('','','option', 1); ?>
      </select>
      </form>

    This works for categories:
    <li id="categories"><?php _e('Categories:'); ?>
    <form action="<?php echo $PHP_SELF ?>" method="get">
    <?php dropdown_cats(); ?>
    <input type="submit" name="submit" value="view" />
    </form>

    I have the whole window.location = value but It’s not being displayed here…

    Anyone for my problem? Anyone?

    Link: Add a submit button and point the form to a php page which grabs the value and redirects to that url.

    Thanks mindlessLemming… That’s just one of those times when you say to yourself: “Why on earth did I not think of that?” Anyhow, thanks.

    Does anyon know how I can style this new archive dropdown menu?
    Help is much appreciated.
    Thanks.

    <form name=”archiveform” action=”” Style=”background-color:#F8F9FD; border: solid #F8F9FD 1px;”>
    u can use the Style command to style 😛

    I’m using this script by 2fargon for my archives dropdown menu. The only problem I came up with is that there’s this annoying “1” in front of each month in the drop menu. How do I remove that? Thanks.

    I have solved this issue at last. I simply removed “1” within php tag and it simply vanished. In case anyone wants to know.

    carthik, can you please post your source in this thread so that it is readable? your initial post looks like this:

    <li id=”archives”>Archives:

    /narchives.php”>Categorized, sortable archives
    <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>

    aeryn or whoever…
    Have same problem that you fixed (the number 1 placed infront of month).
    Everything else works great. Need to know more about how to remove the “1”. My code is…

    • <h2>Archives</h2>

    <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=”>Monthly Records</option>
    <?php get_archives(”,”,’option’, 1); ?>
    </select>
    </form>

    Cheers Jaron

    Moderator James Huff

    (@macmanx)

    Viewing 15 replies - 1 through 15 (of 29 total)
    • The topic ‘archives dropdown menu’ is closed to new replies.