In the day and age of responsive design, it's less often that you run into a situation where you need to truncate your WordPress titles – but it does happen.

When I first learned to do this, I was new at WordPress and had hacked into the core. Now, I've written a quick and easy function to do the job, the WordPress way.

All you have to do is add a little function into your theme's function.php file, and reference the short_title(); function in your templates wherever you need the short title!

Short Titles Function

<?php
function short_title() {
  global $post;
  if ( !$post )
    return;

  $title = $post->post_title;
  if ( 25 < strlen($title) ) {
    $title = substr( $title, 0, 25 ) . '...';
  }

  echo $title;
}

You can now reference short_title(); anywhere within the loop and call your short title. You can adjust how long your title is by changing the number "25" to however many characters you want.