Video tutorial Sidebar management
In this chapter we will see how to declare new "sidebar" in WordPress. These sidebars will then host different widgets that can be selected by the administrator.
function montheme_register_widget () {
register_sidebar ((
'id' => 'homepage',
'name' => 'Home Sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
''
));
}
add_action ('widgets_init', 'montheme_register_widget');
Then it is possible to display our sidebar in our theme
This function will only call a file sidebar-homepage.php
that will have to be created and who will be responsible for displaying the content of the sidebar.
Search
= get_search_form() ?>
Archives
'monthly'))?>
You can inside put default widgets to predict the case where the administrator has not yet configured things.