Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filter Widget Title to add span on first word
add_filter ( 'widget_title', 'kellyboudreau_add_span_widgets' );
function kellyboudreau_add_span_widgets( $old_title ) {
$title = explode( " ", $old_title, 2 );
if ( isset( $title[0] ) && isset( $title[1] ) ) {
$titleNew = "<span>$title[0]</span> $title[1]";
}
else {
return;
}
return $titleNew;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment