Title: Theming the sidebar
Last modified: August 19, 2016

---

# Theming the sidebar

 *  [duckzland](https://wordpress.org/support/users/duckzland/)
 * (@duckzland)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/theming-the-sidebar/)
 * Hi all,
 * I got some problem when trying to add custom html tag for dynamic sidebar.
 * the desired result is :
 *     ```
       <div class="custom">
          <h2>Widget title</h2>
          <div class="custom-wrapper"> <!-- this is the problem -->
           some widget content .....
          </div>
         </div>
       ```
   
 * I tried to use :
 *     ```
       register_sidebar( array(
       		'name' => __( 'Primary Widget Area', 'patriot' ),
       		'id' => 'primary-widget-area',
       		'description' => __( 'The primary widget area', 'patriot' ),
       		'before_widget' => '<div class="custom">',
       		'after_widget' => '</div>',
       		'before_title' => '<h3>',
       		'after_title' => '</h3>',
       	) );
       ```
   
 * which resulted in :
 *     ```
       <div class="custom">
          <h3>widget title</h3>
          some widget content ...
       </div>
       ```
   
 * Is there a way to add a wrapping for the widget content?
 * TIA

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/theming-the-sidebar/#post-1871855)
 * I don’t know if this works but give it a try:
 *     ```
       register_sidebar( array(
       		'name' => __( 'Primary Widget Area', 'patriot' ),
       		'id' => 'primary-widget-area',
       		'description' => __( 'The primary widget area', 'patriot' ),
       		'before_widget' => '<div class="custom">',
       		'after_widget' => '</div></div>',
       		'before_title' => '<h3>',
       		'after_title' => '</h3><div class="custom-wrapper">',
       	) );
       ```
   
 *  Thread Starter [duckzland](https://wordpress.org/support/users/duckzland/)
 * (@duckzland)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/theming-the-sidebar/#post-1871856)
 * Thanks for the reply,
 * I tried it and it is working if the widget has title, and if the widget has no
   title then the html would look like :
 *     ```
       <div class="custom">
           some widget content .....
          </div>
         </div><!-- notice the extra closing div -->
       ```
   
 * Thus breaking all the theme layout.
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/theming-the-sidebar/#post-1871867)
 * Try it with this plugin: [http://wordpress.org/extend/plugins/widget-logic/](http://wordpress.org/extend/plugins/widget-logic/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Theming the sidebar’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/theming-the-sidebar/#post-1871867)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
