Title: Hide Widget Title if Empty
Last modified: August 21, 2016

---

# Hide Widget Title if Empty

 *  [markyeoj](https://wordpress.org/support/users/markyeoj/)
 * (@markyeoj)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hide-widget-title-if-empty/)
 * Hello, I am searching for the possible solution for my problem, but I wasn’t 
   able to find a good one.
 * I just want to remove the before and after widget title if they are empty. I 
   created a style for the title box, and it really looks ugly when empty.
 * Here’s my code
 *     ```
       register_sidebar (array(
       	'name'          => __( 'Homepage with Slider Sidebar', 'carpress_child' ),
       	'id'            => 'hws-sidebar',
       	'description'   => '',
           'class'         => '',
       	'before_widget' => '<div id="%1$s" class="widget %2$s">',
       	'after_widget'  => '</div>',
       	'before_title'  => '<div class="lined"><h2>',
       	'after_title'   => '</h2><span class="bolded-line"></span></div>' ));
       ```
   
 * I hope you can help me out with this.

The topic ‘Hide Widget Title if Empty’ is closed to new replies.

## Tags

 * [function](https://wordpress.org/support/topic-tag/function/)
 * [hook](https://wordpress.org/support/topic-tag/hook/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [markyeoj](https://wordpress.org/support/users/markyeoj/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/hide-widget-title-if-empty/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
