Site icon Catch Themes

Registering a widget area

I don't know php enough to know how to do this properly, but I would like to create a widget area below the #header and above the #main, for the home page. I have a child theme: catch-box-pro-child I found this tutorial: https://devotepress.com/tutorials-hacks/wordpress-coding/how-to-register-sidebars-in-wordpress/ I know I need to register it by dropping code in the functions.php (Can I use the 'child' function.php and just added it to the end, or do I need the entire catch-box-pro functions.php code copied over to my child one??) This is the code that the tutorial tells me to drop in, but I'm not sure It will not be a header, but a "before-content-widget". I tried to edit it but it broke my site until I restored the original functions.php..... so obviously I need help to get the code right? * Register a widget area. */ function register_widget_areas() { register_sidebar( array( 'name' => __( ' Header Widget Area', 'twentyfifteen' ), 'id' =>'header-1', 'description' => __( 'Add widgets here to appear in your header.', 'twentyfifteen' ), 'before_widget' => ' ', 'after_widget' => ' ', 'before_title' => ' <h2 class="widget-title">', 'after_title' => '</h2> ', ) ); } add_action( 'widgets_init', 'register_widget_areas' ); ; Then I don't know where to drop this: . <!--?php if ( is_active_sidebar( 'header-1' ) ) : ?--> <div class="header-area"></div> The example is using header so they are dropping it into the header.php.... but I want it above the content area, including above any sidebars. Is this the best way to do this??
Exit mobile version