Skip to content

Instantly share code, notes, and snippets.

@rickrduncan
Last active January 11, 2016 12:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickrduncan/6088012 to your computer and use it in GitHub Desktop.
Save rickrduncan/6088012 to your computer and use it in GitHub Desktop.
<?php
//* Do NOT include this comment or the opening php tag above
//* Wrap first word of widget title into a span tag
add_filter ( 'widget_title', 'b3m_add_span_widgets' );
function b3m_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