WordPress.org

Ready to get started?Download WordPress

Forums

Cannot run two instances of wp_dropdown_categories. One works, second will not. (1 post)

  1. slobizman
    Member
    Posted 4 years ago #

    I am trying to get two instances of this category dropdown code in a widget working, but while it works with just one widget, when I have two widgets going only the first one works properly, and the second one looks as though it's working but when I make a selection it will not bring up the archive page.

    Each of the two widgets has a different "child_of=xxx" for a different group of children.

    I also tried a plugin (Alpha's Categories Widget) and it does the same thing.

    Anyone know why I can't run two instances of wp_dropdown_categories?

    <li>	<?php wp_dropdown_categories('show_option_none=Select Lecturer&child_of=277&orderby=name'); ?>
    
    <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>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags