If that is all of your “title” code, you aren’t echo
ing $before_title
and $after_title
. Look at how the default text widget, which you reference, does it:
399 function widget( $args, $instance ) {
400 extract($args);
401 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
402 $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );
403 echo $before_widget;
404 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
405 <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
406 <?php
407 echo $after_widget;
408 }
Look at line 404. I don’t see the “before” and “after” in your code.