Archives – Post Filter Month dropdown on front-end like WordPress backend

When I run the following code.

$args = array(
    'type'            => 'monthly',
    'limit'           => '',
    'format'          => 'option', 
    'before'          => '',
    'after'           => '',
    'show_post_count' => false,
    'echo'            => 1,
    'order'           => 'DESC',
    'post_type'     => 'post'
<option value=""> Select </option>
    wp_get_archives( $args ); 
?>  </select>

i got this output

<option> Select </option>
    <option value=""> March 2016 </option>
<option value=""> February 2016 </option></select>

But I need the output like wordpress back end filter option. hence

    <select name="m" id="filter-by-date"><option selected="selected" value="0">All dates</option><option value="201603">March 2016</option><option value="201602">February 2016</option></select>

Thank you,

Leave a Comment