Archive with dropdown list of Year, Month, and Day

If you want to put a archive from 3 dropdown list with Year, Month and Day and Go button that will show the list of post that selected by date archive. All you need to do is create a search form with appropriately named inputs.

<form method="get" action="<?php echo home_url( '/' ); ?>">
    <select name="day">
    <?php foreach( range(1,31) as $day_of_month ) : ?>
        <option><?php echo $day_of_month; ?></option>
    <?php endforeach; ?>
    </select>
    <select name="monthnum">
    <?php foreach( range(1,12) as $month_of_year ) : ?>
        <option><?php echo $month_of_year; ?></option>
    <?php endforeach; ?>
    </select>
    <select name="year">
    <?php foreach( range(2000,2011) as $_year ) : ?>
        <option><?php echo $_year; ?></option>
    <?php endforeach; ?>
    </select>
    <input type="submit" id="searchsubmit" value="Search" />
</form>

Source: http://wordpress.stackexchange.com/questions/12407/archive-in-sidebar-with-dropdown-list-of-year-month-day

You may also like...