Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

hi i'm using the Categories widget show hierarchy. I leave the space for title because I don't need to show any title. but it then displays on the website as "Categories". how can I remove that?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

There is a filter you can use to do this. (Kruti has even found it, but instead of using it, he modified core files...)

$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base);

So what you really need to do, is to add this to your functions.php:

function my_repair_categories_empty_title($title, $instance, $base) {
    if ( $base == 'categories' ) {
        if ( trim($instance['title']) == '' )
            return '';
    }
    return $title;
}
add_filter('widget_title', 'my_repair_categories_empty_title', 10, 3);
share|improve this answer
    
i added this code in functions.php and it works well. but i have a doubt.is this function affect any other widget's title in future??sorry if my doubt is unnecessary. –  Ammu Nov 26 '13 at 10:40
    
It will affect any categories widget. No other widgets should be affected. –  Krzysiek Dróżdż Nov 26 '13 at 11:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.