Remove more or […] text from short post

I use a theme that have a character limit for shortpost and show […] at the end of character limit.

I want to remove this, so I search for the_excerpt(); and replace with the_content();

The problem solve with normal content but still have problem with image post type and there is <?php the_excerpt(); ?> that when I change this my shortpost act like full post and it’s not related to the length of post.

I try to open all PHP files in theme and looking for key words like: limit, length, excerpt for find where is the code that define the length of shortpost even search for “[…]” in all files and language but I don’t know where is that come from.

But all I find is some line of code in function.php

if ( ! function_exists( 'string_limit_words' ) ) :
function string_limit_words($str, $limit = 18 , $need_end = false) {
    $words = explode(' ', $str, ($limit + 1));
    if(count($words) > $limit) {
        array_pop($words);
        array_push($words,'...');
    }
    return implode(' ', $words);
}
endif;

And when I increase 18 nothing change!

What code I must looking for?

6

The codex is your friend and should be your first stop 🙂

The [...] is added by the_excerpt(). There is a filter supplied called the excerpt_more filter that is specifically included to customize the read more text after the excerpt

To remove the [...] after the excerpt text, you can do the following

function new_excerpt_more( $more ) {
    return '';
}
add_filter('excerpt_more', 'new_excerpt_more');

Leave a Comment