Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Created September 30, 2014 20:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredatch/819aa8499a23839465a3 to your computer and use it in GitHub Desktop.
Save jaredatch/819aa8499a23839465a3 to your computer and use it in GitHub Desktop.
jQuery(function($){
// Last word in title
$('.sidebar-primary .widget-title').html(function(){
var text = $(this).text().split(' ');
var last = text.pop();
return text.join(" ") + (text.length > 0 ? ' <span class="last">'+last+'</span>' : last);
});
// First word in title
$('.sidebar-primary .widget-title').html(function(){
var text = $(this).text().split(' ');
var first = text.shift();
return (text.length > 0 ? '<span class="first">'+first+'</span> ' : first) + text.join(" ");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment