# Register Extra Widget Areas

> Creates additional widget areas, such as a shop sidebar or a blog sidebar, that you can fill under Appearance > Widgets and place with a shortcode or theme hook.

- Type: PHP
- Runs: Run everywhere
- Category: [Widgets](https://wpide.com/library/category/widgets/)
- Tags: widgets, sidebar, register
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/register-extra-widget-areas/

## Code

```php
// Widget area ID => name.
$wpide_extra_widget_areas = array(
    'wpide-blog-sidebar' => 'Blog Sidebar',
    'wpide-shop-sidebar' => 'Shop Sidebar',
);

add_action( 'widgets_init', function () use ( $wpide_extra_widget_areas ) {
    foreach ( $wpide_extra_widget_areas as $id => $name ) {
        register_sidebar( array(
            'id'            => $id,
            'name'          => $name,
            'description'   => sprintf( 'Show it with [widget_area id="%s"].', $id ),
            'before_widget' => '<section id="%1$s" class="widget %2$s">',
            'after_widget'  => '</section>',
            'before_title'  => '<h2 class="widget-title">',
            'after_title'   => '</h2>',
        ) );
    }
} );
```

## Notes

Add or rename areas in the list. Show them with [widget_area id="..."] from the Widget Area Shortcode snippet.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Register Extra Widget Areas" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
