I am looking to have a drop down menu at the top of the archive page or other pages with post loop that will allow the users to filter posts by date (year)
There will be a drop down with all the years posts are published. Eg: 2017, 2018, 2019
<?php $args = array( 'cat' => $FeaturedNewsCat, 'posts_per_page' => 2, 'order' => DSC ); $the_query = new WP_Query($args); while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <!--Post Template Comes Here--> <?php endwhile; wp_reset_postdata(); ?>
Please tell me what I have to do to implement the filter function. Any help is appreciated.