• Resolved spk

    (@spk)


    this code creates a drop down menu with all Categories. i would like to learn how to modify it so it shows Archives instead of categories. i.e. sort posts by months. how should this be done?

    thanks

    <?php wp_dropdown_categories('show_option_none=Sort by Category'); ?>
    
    	<script type="text/javascript">
        var dropdown = document.getElementById("cat");
        function onCatChange() {
    		if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
    			location.href = "<?php echo get_option('home');
    ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
    		}
        }
        dropdown.onchange = onCatChange;
    </script>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘sort by archives in dropdown menu’ is closed to new replies.