Skip to content

Instantly share code, notes, and snippets.

@rickalee
Created June 6, 2014 17:41
Show Gist options
  • Save rickalee/6e4e2927adfd66c7ca0b to your computer and use it in GitHub Desktop.
Save rickalee/6e4e2927adfd66c7ca0b to your computer and use it in GitHub Desktop.
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