WordPress.org

Ready to get started?Download WordPress

Forums

category drop down menu issue (2 posts)

  1. gatorgse
    Member
    Posted 6 years ago #

    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

  2. gatorgse
    Member
    Posted 6 years ago #

    any replies available :) I'm not usre what I did wrong as this was right off the page in WordPress

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags