• I know there’ve been many posts about adding a drop down menu for archives and for categories but mine is a little different. I downloaded the WordPress Shortcodes plugin to my site and use it to display a welcome message, buttons, and contact information. I’d like to add a tab that will display a search button and drop down menus for my archives and templates.

    I have tried using this code, but it will not work for me.

    Browse by month:

    <div id="archives"><select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
      <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option>
      <?php wp_get_archives( array( 'type' => 'monthly', 'format' => 'option', 'show_post_count' => 1 ) ); ?>
    </select></div>
    
    Browse by category:
    <div id="cats"><?php wp_dropdown_categories('show_option_none=Select 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>
    </div>

    I’m very new to html, css, and php so please keep that in consideration when helping me out!

    My website is https://www.craftywife.com.

    Thank you in advance!

  • The topic ‘Drop down Menus to use in WordPress Shortcodes plugin’ is closed to new replies.