Answer the question
In order to leave comments, you need to log in
How to limit header length in WordPress?
I want to limit title length only in Recent Posts. I have the Recent Post Extended plugin, maybe this plugin has such a function, I don't know. Tell me how it can be done
Answer the question
In order to leave comments, you need to log in
Hello.
I won’t tell you how specifically for the plugin to limit the length of the title, but this option works for regular posts:
Add to functions.php
// длина заголовка
function the_title_excerpt($before = '', $after = '', $echo = true, $length = false)
{
$title = get_the_title();
if ( $length && is_numeric($length) ) {
$title = substr( $title, 0, $length );
}
if ( strlen($title)> 0 ) {
$title = apply_filters('the_title_excerpt', $before . $title . $after, $before, $after);
if ( $echo )
echo $title;
else
return $title;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question