Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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