# Add a "Sidebar" Area for Template Parts

> Adds a "Sidebar" area next to Header and Footer in the Site Editor, so sidebar template parts get their own section, icon and the right HTML tag.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: template-parts, site-editor, block-themes
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/template-part-area-sidebar/

## Code

```php
add_filter( 'default_wp_template_part_areas', function ( $areas ) {
    foreach ( $areas as $area ) {
        if ( isset( $area['area'] ) && 'sidebar' === $area['area'] ) {
            return $areas;
        }
    }

    $areas[] = array(
        'area'        => 'sidebar',
        'area_tag'    => 'aside',
        'label'       => 'Sidebar',
        'description' => 'Content shown beside the main column, such as widgets or calls to action.',
        'icon'        => 'sidebar',
    );

    return $areas;
} );
```

## Notes

Create a template part and choose "Sidebar" as its area in the Advanced panel.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Add a "Sidebar" Area for Template Parts" 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/
