In this post today I will discus How to Add New Custom Widget Area in WordPress theme. Each new developer need to learn WordPress basics, Also need to know how customize your WordPress site.
After creating new themes developer to customize WordPress themes, So need to know how to create custom Widget area and display Widget area in WordPress theme.
Registering a Custom Widget Area:
Let’s start and registering a widget area add following code in your theme functions.php file by method register_sidebar. It will be located in public_html/wp-content/themes/YOUR_THEME_NAME/functions.php Open this file via editor and add following code to registering new Widget area.
After register a new widget area, WordPress automatically display it as an option under Appearance => Widgets in WordPress admin section. My custom Widget name is “Single Page Top Sidebar” and ID is “sidebar_single_top”.
Display Your Specific Custom Widget Area:
WordPress not automatically display your newly created Widget area on frontend theme. Because we have not yet told to WordPress where to display newly created Widget area. I have create new widget are for post single page sidebar top place widget area.
Now I need to edit the public_html/wp-content/themes/YOUR_THEME_NAME/singular.php file via editor in your theme and add following code in DIV with .sidebar class to display your custom widget area.
You can create Widget area for any page section like Header, Sidebar, Page Content and Footer with using PHP WordPress conditions.
Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Please SHARE this post.