How To Display WordPress Archives in a Drop Down Menu

How To Display WordPress Archives in a Drop Down Menu

Sometimes you don’t want your archives taking up much space in your sidebar, footer, or elsewhere.

Here’s a snippet that you can add anywhere in your template files to display a drop-down menu of your archives in order to conserve space:

<select name="\"archive-dropdown\"" onchange="document.location.href=this.options[this.selectedIndex].value;"><?php echo attribute_escape(__('Select Month')); ?><?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?>

This will produce a little something like what’s shown in the thumbnail above.

Source: WPhacks.com

Free Video Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch) Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.
Tags: