I am currently working on a theme that uses a Page Sidebar for the Contact, About, Portfolio and Home pages, and a Blog Sidebar for the Blog page.
For some reason, the Page Sidebar is not showing up on any of its respective pages. I ran my theme through a WordPress theme validator, which gave me the following error message:
"Sidebars need to be registered in a custom function hooked to the widgets_init action. See: register_sidebar()."
For reference, here is the code that I used to register and create both sidebars:
function wpt_create_widget( $name, $id, $description ) {
register_sidebar(array(
'name' => __( $name ),
'id' => $id,
'description' => __( $description ),
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h2 class="module-heading">',
'after_title' => '</h2>'
));
}
wpt_create_widget( 'Page Sidebar', 'page', 'Displays on the side of pages with a sidebar' );
wpt_create_widget( 'Blog Sidebar', 'blog', 'Displays on the side of pages in the blog section' );
Can anyone give me advice as to what specific PHP files I should be focusing on, to correct the issue? The files that I've potentially narrowed it down to are:
functions.php
page-sidebar-left.php
sidebar.php (Blog Sidebar)
sidebar-page.php (Page Sidebar)