0

I am using Automattic's own Isola theme on my blog. It's a single column theme and it has a sidebar which pops up from the left if clicked on show more kind of button on the left side of site title.

Somehow I managed to disable the sidebar by removing the linking javascript event and the attached HTML. Now I want to add a sidebar to the right for related posts, ads and other stuffs.

How can I do so? Is there any specific detailed tutorial on the internet for this? I have heard the sidebars have to be registered somewhere, but I totally didn't get the stuffs. I am looking for detailed answer.

1 Answer 1

1

Go to the functions.php file inside of your theme and search for register_sidebar it could look like this:

function isola_widgets_init() {
    register_sidebar( array(
        'name'          => esc_html__( 'Sidebar', 'isola' ),
        'id'            => 'sidebar-1',
        'description'   => '',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>',
    ));
}
add_action( 'widgets_init', 'isola_widgets_init' );

and change it to e.g.:

function isola_widgets_init() {
    register_sidebar( array(
        'name'          => esc_html__( 'Sidebar', 'isola' ),
        'id'            => 'sidebar-1',
        'description'   => '',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>',
    ) );
    register_sidebar( array(
        'name'          => esc_html__( 'Sidebar 2', 'isola' ),
        'id'            => 'sidebar-2',
        'description'   => '',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>',
    ) );
}
add_action( 'widgets_init', 'isola_widgets_init' );
3
  • Explain me more! What does it does? Will it appear at the side as I am wanting? Or the same way it was by default in Isola theme? Commented Sep 25, 2015 at 4:55
  • For me, they just aren't appearing. :/ Commented Sep 25, 2015 at 5:12
  • To show widgets in the sidebar location of your choice in the frontend, head into header.php or footer.php etc. inside of your tempalte folder and put there this code <?php dynamic_sidebar( 'sidebar-2' ); ?> . Of course, put some widget in the newly created "Sidebar 2" box in the widget section of WP admin, so something will show in header or footer etc. section of your page. Commented Sep 25, 2015 at 16:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.