Sidebar - ar-to/WordPress-Theme GitHub Wiki
Adding a sitebar inside the functions.php will make the Widgets option available inside the settings. See OS training, hide a sidebar for more info. Begin by adding the following inside functions.php
//register sidebar
add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
/* Register the 'primary' sidebar. */
register_sidebar(
array(
'id' => 'primary',
'name' => __( 'Primary Sidebar' ),
'description' => __( 'A short description of the sidebar.' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
/* Repeat register_sidebar() code for additional sidebars. */
}
Now create a new default file called sidebar.php inside the root directory and add
<div id="sidebar-primary" class="col-md-4">
<?php dynamic_sidebar( 'primary' ); ?>
</div>
I added a column class 4 so now I need to change the column inside index.php what holds the loop to class="col-md-8"
to equal 12 for max Bootstrap width. Then I add the function to call this new template file into index.php right below the div containing the loop.
<?php get_sidebar(); ?>