Fix Templatic’s Private Lawyer text-being-truncated-on-slider bug

I was having problems with the Coda Slider in the Private Lawyer Wordpress Theme by Templatic. (The slider is called the T Anything Slider widget by the theme.) Text was being truncated even when the text length was less than the number of characters specified on the widget settings.

A small modification to the bm_better_excerpt function in wp-content/themes/PrivateLaweyer/library/functions/custom_functions.php solves the problem.

File: wp-content/themes/PrivateLaweyer/library/functions/custom_functions.php

// Excerpt length
function bm_better_excerpt($length, $ellipsis) {
$text = get_the_content();
// fix weird bug that caused substr to chop
// text even if $length was greater than string length
if (strlen($text) > $length) {
$text = strip_tags($text);
$text = substr($text, 0, $length);
$text = substr($text, 0, strrpos($text, " "));
$text = $text.$ellipsis;
return $text;
php private lawyer theme templatic wordpress wordpress theme

Join my free newsletter and receive updates directly to your inbox.