Forums
Home / Fixing WordPress / add new sidebar in child theme
(@jrcollins)
8 years, 6 months ago
I want to create a new sidebar widget area in the header of my child theme. What would be the best way to do this?
Here is the code for one of the sidebars in the parent theme:
<?php add_action( 'widgets_init', 'ci_widgets_init' ); if( !function_exists('ci_widgets_init') ): function ci_widgets_init() { register_sidebar(array( 'name' => __( 'Blog Sidebar', 'ci_theme'), 'id' => 'blog-sidebar', 'description' => __( 'The list of widgets assigned here will appear in your blog posts.', 'ci_theme'), 'before_widget' => '<aside id="%1$s" class="widget %2$s group">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title"><span>', 'after_title' => '</span></h3>', )); }
Can I just change the name, id and description and put it in my child theme’s functions file?
(@james-roberts)
Hi, http://codex.wordpress.org/Widgetizing_Themes you should be able to this approach.
Thanks.
Thanks for the link. It’s working now.