Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jackfearing/c595d4681a2aa606f662e73c09d7a458 to your computer and use it in GitHub Desktop.

Select an option

Save jackfearing/c595d4681a2aa606f662e73c09d7a458 to your computer and use it in GitHub Desktop.
//Display short blog title in WordPress
//There is a simple script you can use to implement a short blog title without modifying the base WordPresscode. Open up your functions.php file within your theme and add the following:
function short_title() {
$title = get_the_title();
$count = strlen($title);
if ($count >= 25) {
$title = substr($title, 0, 25);
$title .= '...';
}
echo $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment