Lego2012
12/13/2016 - 2:56 PM

Wrap widget titles in a custom span

Wrap widget titles in a custom span

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

// Add span class to widget headlines
add_filter( 'widget_title', 'bsoa_widget_title' );
function bsoa_widget_title( $title ){
    if ( $title )
    return sprintf ('<span class="widget-headline">%s</span>', $title );
}

<!-- Sample Output: -->

<h3 class="widgettitle widget-title"><span class="widget-headline">Meta</span></h3>