How to Create A New Widget Area (Sidebar) For Pages in Twenty-seventeen
-
Hello,
A friend told me about Twenty Seventeen Theme. I am glad they did. I like the look of it – nice and modern. It has some great features and is customizable. You do some great things for us. Thanks.I am used to having more widget areas I can add to a word press page. I would like to put another widget area just above the page footer. I tried to follow ideas from others but am getting errors when trying to create a new widget (sidebar) area to be used at end of page before footer .
For just a couple of new widget areas I do not want to install a plug in so am wrestling with the code. I would like to learn how to do this.
Here is what I tried so far:
1) I created a Child theme using Twenty seventeen child theme.
2) I registered by new widgets by adding new function for new widget in child theme functions.php (does it matter what I call the function name? I found out I had to use a new function name otherwise I received the error ‘already exists’. Do I have a problem with my contents in the arrays? Here’s my code :add_action( 'widgets_init', 'wpw_widgets_init' ); function wpw_widgets_init() {register_sidebar( array( 'name' => 'page widget1', 'id' => 'pagewidget1', 'description' => 'Add widgets here to appear in page widget 1 template.', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); }
3) I created a new sidebar-pagewidget1.php using the following code.
if ( is_active_sidebar( 'pagewidget1' ) ) : ?> <aside id="secondary" class="chw-widget-area" role="complementary"> <?php dynamic_sidebar( 'pagewidget1' ); ?> </aside><!-- #secondary -->
4) I created a new page-widget1.php by copying page.php and adding get to new widget area. I am including just the section that I added for the widget area.
</main><!-- #main --> </div><!-- #primary --> <?php get_sidebar(‘pagewidget1’); ?> </div><!-- .wrap --> <?php get_footer();
When installing the twentyseventeen-child theme I get the following warning message
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘TransferOutBeforeUpgrade’ not found or invalid function name in /var/www/volumes/xvdf5/vhosts/test.findoutmorequickly.com/httpdocs/wp-includes/class-wp-hook.php on line 298Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘TransferInAfterUpgrade’ not found or invalid function name in /var/www/volumes/xvdf5/vhosts/test.findoutmorequickly.com/httpdocs/wp-includes/class-wp-hook.php on line 300
5) I tried putting the
add_action('widgets_init', 'wpb_widgets_init' );
after the register widgets but that did not make a difference.6) I looked at class-wp-hook-php and I believe it is referring to
add_action( 'widgets_init', 'wpw_widgets_init' );
When I activate the child theme I cannot get into my testing website. I get a 500 Internal Server Error.Some guidance would be much appreciated. Thanks for your hard work.
Tommy
- The topic ‘How to Create A New Widget Area (Sidebar) For Pages in Twenty-seventeen’ is closed to new replies.