WordPress.org

Support

Support » How-To and Troubleshooting » category drop down menu issue

category drop down menu issue

  • I want to change the category list in the sidebar to a drop down menu. I used this code:

    <li id="categories"><h2><?php _e('Posts by Category'); ?></h2>
    <?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>
    </li>

    This is coming up not valid in XHTML. Any suggestions on a better method?

    Thanks

Viewing 1 replies (of 1 total)
  • any replies available 🙂 I’m not usre what I did wrong as this was right off the page in WordPress

Viewing 1 replies (of 1 total)
  • The topic ‘category drop down menu issue’ is closed to new replies.
Skip to toolbar