Last active
December 8, 2022 09:40
-
-
Save robgolbeck/0104062134480c8f3cf3 to your computer and use it in GitHub Desktop.
WordPress Create Drop Down List of Monthly Archives
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: https://codex.wordpress.org/Function_Reference/wp_get_archives | |
<select class="turnintodropdown" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;"> | |
<option value=""><?php echo esc_attr( __( 'Monthly Archives' ) ); ?></option> | |
<?php wp_get_archives( array( 'type' => 'monthly', 'format' => 'option' ) ); ?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment