Editing excerpt length for homepage slider not having any effect
-
I would link to an example but I’m hosting this on my local machine right now. Here’s my problem:
I’m trying to get my slider text excerpts to be full length. For context, these are dedicated slider-only posts that I’m redirecting to the relevant pages, not multi paragraph blog posts. Each slider post has about 10 words in it.
I’ve noticed that it always truncates the last word with and puts a … after it. I’d like it to show the whole excerpt, and not have the …
I’ve found the following code by browsing other support threads:
function get_slider_excerpt(){
$excerpt = get_the_content();
$excerpt = preg_replace(” (\[.*?\])”,”,$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, 300);
$excerpt = substr($excerpt, 0, strripos($excerpt, ” “));
$excerpt = trim(preg_replace( ‘/\s+/’, ‘ ‘, $excerpt));
return $excerpt;Modified excerpt length to be 300 rather than 150 but there’s no change in behavior of the element. Am I forgetting something?
Thank you in advance for any help.
- The topic ‘Editing excerpt length for homepage slider not having any effect’ is closed to new replies.