Make WordPress Core

Changeset 13701


Ignore:
Timestamp:
03/14/2010 12:12:23 PM (15 years ago)
Author:
dd32
Message:

Restore backwards compatibility of integer sidebars("sidebar-$i"). See #12606

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/widgets.php

    r13700 r13701  
    482482        parse_str($args, $args);
    483483
    484     $n = count($wp_registered_sidebars);
    485484    for ( $i = 1; $i <= $number; $i++ ) {
    486485        $_args = $args;
     
    492491
    493492        // Custom specified ID's are suffixed if they exist already.
    494         // Automatically generated sidebar names need to be suffixed regardless.
     493        // Automatically generated sidebar names need to be suffixed regardless starting at -0
    495494        if ( isset($args['id']) ) {
    496495            $_args['id'] = $args['id'];
     496            $n = 2; // Start at -2 for conflicting custom ID's
    497497            while ( isset($wp_registered_sidebars[$_args['id']]) )
    498498                $_args['id'] = $args['id'] . '-' . $n++;
    499499        } else {
     500            $n = count($wp_registered_sidebars);
    500501            do {
    501                 $_args['id'] = 'sidebar-' . $n++;
     502                $_args['id'] = 'sidebar-' . ++$n;
    502503            } while ( isset($wp_registered_sidebars[$_args['id']]) );
    503504        }
Note: See TracChangeset for help on using the changeset viewer.