Rename sidebar to sidebar-1

Matches the parent theme, so widgets should be pre-placed.
This commit is contained in:
Oliver Davies 2019-04-16 20:25:28 +01:00
parent 6acc6b22a5
commit 91cdf824f2
2 changed files with 12 additions and 6 deletions

View file

@ -2,15 +2,21 @@
wp_enqueue_style( 'style', get_stylesheet_uri() );
// override the widget styles for sidebar-1
add_action('after_setup_theme', function () {
remove_action( 'widgets_init', 'twentynineteen_widgets_init' );
});
add_action('widgets_init', function () {
register_sidebar(
array(
'name' => 'Sidebar',
'id' => 'tw-sidebar',
'before_title' => '<h2 class="text-4xl font-bold text-gray-800 mt-6 mb-4 tracking-tight">',
'id' => 'sidebar-1',
'before_title' => '<h2 class="text-5xl font-bold mt-6 mb-4 tracking-tight">',
'after_title' => '</h2>',
'before_widget' => '<div class="mt-10 w-1/2 px-6">',
'before_widget' => '<div class="mt-10 w-1/2 px-6 text-2xl">',
'after_widget' => '</div>',
)
);
});

View file

@ -7,14 +7,14 @@
* @since 1.0.0
*/
if ( is_active_sidebar( 'tw-sidebar' ) ) : ?>
if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<aside class="widget-area" role="complementary" aria-label="<?php esc_attr_e( 'Footer', 'twentynineteen' ); ?>">
<?php
if (is_active_sidebar('tw-sidebar')) {
if (is_active_sidebar('sidebar-1')) {
?>
<div class="widget flex flex-wrap -mx-6">
<?php dynamic_sidebar('tw-sidebar'); ?>
<?php dynamic_sidebar('sidebar-1'); ?>
</div>
<?php
}