[wp-trac] [WordPress Trac] #19709: Add 'before_sidebar' and 'after_sidebar' attributes to register_sidebar()
WordPress Trac
noreply at wordpress.org
Mon Nov 16 14:28:57 UTC 2020
#19709: Add 'before_sidebar' and 'after_sidebar' attributes to register_sidebar()
--------------------------------------+-----------------------
Reporter: dgwyer | Owner: audrasjb
Type: task (blessed) | Status: reopened
Priority: high | Milestone: 5.6
Component: Widgets | Version: 2.2
Severity: normal | Resolution:
Keywords: has-unit-tests has-patch | Focuses:
--------------------------------------+-----------------------
Comment (by audrasjb):
Yes, it's up to developers to use a different ID for each sidebar, but I
think it's pretty logicial to give each sidebar a different ID. Also,
there is a different ID for each sidebar by default:
{{{
function register_sidebar( $args = array() ) {
global $wp_registered_sidebars;
$i = count( $wp_registered_sidebars ) + 1;
$id_is_empty = empty( $args['id'] );
$defaults = array(
/* translators: %d: Sidebar number. */
'name' => sprintf( __( 'Sidebar %d' ), $i ),
'id' => "sidebar-$i",
'description' => '',
'class' => '',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => "</li>\n",
'before_title' => '<h2 class="widgettitle">',
'after_title' => "</h2>\n",
'before_sidebar' => '',
'after_sidebar' => '',
);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/19709#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list