WordPress.org

Make WordPress Core

Ticket #13019: multiple_category_jumpmenus2.patch

File multiple_category_jumpmenus2.patch, 1.4 KB (added by t31os_, 8 years ago)

Using parent class $number va for counter

  • default-widgets.php

     
    439439
    440440                if ( $d ) {
    441441                        $cat_args['show_option_none'] = __('Select Category');
    442                         wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args));
     442                        $widget_number = $this->number;
     443                        $dropdown_name = $cat_args['name'] = 'category_jumpmenu' . $widget_number;
     444                        wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args' , $cat_args ) );
    443445?>
    444446
    445447<script type='text/javascript'>
    446448/* <![CDATA[ */
    447         var dropdown = document.getElementById("cat");
    448         function onCatChange() {
    449                 if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
    450                         location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
     449        var dropdown<?php echo $widget_number; ?> = document.getElementById("<?php echo $dropdown_name; ?>");
     450        function on<?php echo $dropdown_name; ?>Change() {
     451                if ( dropdown<?php echo $widget_number; ?>.options[dropdown<?php echo $widget_number; ?>.selectedIndex].value > 0 ) {
     452                        location.href = "<?php echo home_url(); ?>/?cat="+dropdown<?php echo $widget_number; ?>.options[dropdown<?php echo $widget_number; ?>.selectedIndex].value;
    451453                }
    452454        }
    453         dropdown.onchange = onCatChange;
     455        dropdown<?php echo $widget_number; ?>.onchange = on<?php echo $dropdown_name; ?>Change;
    454456/* ]]> */
    455457</script>
    456458