Languages: English • 日本語 (Add your language)
Creates multiple Sidebars.
Registers one or more sidebars to be used in the current theme. Most themes have only one sidebar. For this reason, the number parameter is optional and defaults to one.
The args array parameter can contain a 'name' which will be prepended to the sidebar number if there is more than one sidebar. If no name is specified, 'Sidebar' is used.
<?php register_sidebars( $number, $args ); ?>
<?php $args = array( 'name' => __('Sidebar %d'), 'id' => 'sidebar', 'description' => '', 'class' => '', 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' ); ?>
The optional args
parameter is an associative array that will be passed as a first argument to every active widget callback. (If a string is passed instead of an array, it will be passed through parse_str() to generate an associative array.) The basic use for these arguments is to pass theme-specific HTML tags to wrap the widget and its title.
None.
This will register 1 sidebar named Sidebar:
register_sidebars();
This will create 2 sidebars named “Foobar 1″ and “Foobar 2″:
register_sidebars(2, array('name'=>'Foobar %d'));
This will create 2 sidebars with <h1> and </h1> before and after the title:
register_sidebars(2, array('before_title'=>'<h1>','after_title'=>'</h1>'));
Since: 2.2.0
register_sidebars() is located in wp-includes/widgets.php
.
Sidebars: is_active_sidebar(), is_dynamic_sidebar(), dynamic_sidebar(), register_sidebars(), register_sidebar(), unregister_sidebar(), wp_register_sidebar_widget(), wp_unregister_sidebar_widget(), wp_get_sidebars_widgets(), wp_set_sidebars_widgets()