Adding a Custom Widget Area To A WordPress Theme
This guide will cover adding a custom widget area to a WordPress theme. For this example, we will be adding a new widget area to the top of an Archive page.
This guide assumes that you have already setup a WordPress child theme.
Edit your functions.php
Add this code replacing the relevant data with your own.
1 | function archive_widgets_init() { |
Add the follwing code to your theme file where you want to insert the new Widget area
1 | if ( is_active_sidebar( 'custom-archive-widget' ) ) : |
Adding new Widgets
You should now be able to see your new Widget area under Apperance -> Widgets. Add your Widgets here and they will show up one the page.