• Resolved Green Charge Networks

    (@green-charge-networks)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Template Express

    (@danstriker)

    Hi you have to remove the … in the custom_home.php file:

    <a href="<?php the_permalink() ?>">...</a></p>

    To have full length text remove the following from functions.php:

    $excerpt = substr($excerpt, 0, 150);

    To remove the last word truncation reove the following from functions.php:

    $excerpt = substr($excerpt, 0, strripos($excerpt, " "));

    rememeber to remove these from the homepage slider excerpt and not the homepage recent posts excerpt in the functions file.

    Theme Author Template Express

    (@danstriker)

    Hello, marking this as resolved as it has been tested and is part of most recent theme update.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Editing excerpt length for homepage slider not having any effect’ is closed to new replies.