Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to put a archive into sidebar. I need to select archive from 3 dropdown list with

  1. Year
  2. Month and
  3. Day
  4. and Go button.

When I select Year-Month-Day from 3 dropdown lists and click on Go button then selected date archive post will show.

Please help me how it possible

Thanks, amazon

share|improve this question
    
Do you have one or multiple posts on a specific date? What does happen if there are no posts on a date? –  hakre Mar 19 '11 at 19:40
    

1 Answer 1

Year, Month and Day are all public query variables, 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>

Totally untested, but it should do the trick, let me know of any problems.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.