Hi I wanted to create extra sidebar in my theme and I am not sure if what I did is correct.
In my theme functions.php I found this function:
function blankslate_widgets_init() {
register_sidebar( array (
'name' => __('Sidebar Widget Area', 'blankslate'),
'id' => 'primary-widget-area',
'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
'after_widget' => "</li>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
and Inside I pasted the new sidebar so it is like that now
register_sidebar( array (
'name' => __('Sidebar Widget Area', 'blankslate'),
'id' => 'primary-widget-area',
'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
'after_widget' => "</li>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array (
'name' => __('Left Sidebar', 'blankslate'),
'id' => 'left_sidebar',
'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
'after_widget' => "</li>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
after I've done this the widget appears in the dashboard perfectly
then I add this code where I wanted the sidebar to appear
<?php dynamic_sidebar('left_sidebar'); ?>
and that worked perfectly for me.
I'm not sure if this is the correct way and just worried if my theme will crush.
Can anyone advise me please?