Dealing with Long Breadcrumb Titles

I encountered a problem relates to post titles being too long to fit into the space the box allowed causing them to break to the next line. This looked absolutely terrible.

Rather than confining authors to short titles I wanted to do something that would only change the length of the title in the breadcrumb and leave it intact otherwise.

The solution was to go to the the theme folder open includes/breadcrumbs.php  and replace get_the_title with the following code which truncates the page title for use in the breadcrumbs section to no more than 25 characters.

 

$my_title= get_the_title();
$my_title=substr($my_title, 0, 25);
$new_title="$my_title ...";
echo($new_title);

A word on child themes

You can make this edit directly in the themes directory but it’s better to do it as a child theme so that as the theme make updates your adjustment isn’t overwritten.

For complete instructions on using child themes please see http://codex.wordpress.org/Child_Themes .

It may seem like a little work on the front end but you will be thanking yourself later as you add more and more modifications to the theme files. As soon as the theme updates all of you changes will be wiped out if you don’t use child themes.

Author: Brian Marshall

Share This Post On