Excerpt Length & List Category Posts Plugin

I'm trying to filter out the excerpt by character length for a plugin called "List Category Posts". I've been trying to get the excerpts working for the past week, but nothing is doing the trick. The plugin actually comes with a feature that allows you to post the excerpt or not, then filter it by character length.. by adding "excerpt_size=" in the shortcode. But unfortunately, it doesn't work at this time, and I've tested it with multiple different themes. Anyways, here is the code it uses to get the excerpt:

public function get_excerpt($single){
    if (
            $this-params['excerpt']=='yes' 
            !($this-params['content']=='yes' 
            $single-post_content) ){
        /*
         * Strip shortcodes - #5
         * http://codex.wordpress.org/Function_Reference/strip_shortcodes
        */
        if($single-post_excerpt){
            return $single-post_excerpt;
        }
        $lcp_excerpt = strip_shortcodes(strip_tags($single-post_content));
        $exc_lim = intval($this-params['excerpt_size']);
        $lcp_excerpt = mb_substr($lcp_excerpt, 0, $exc_lim) . '...';
        return $lcp_excerpt;
    } else {
        return null;
    }
}

and the excerts are set by default like so (I've tried changing the 'excerpt_size' default parameter below, and it did not work):

'excerpt' = 'no',
'excerpt_size' = '255',

I don't even need a grand solution to get the whole shortcode excerpt filter to work with any number I enter. If anyone could help me get it to work so all the excerpt character lengths are say, 100. That would be amazing!

Topic plugin-list-category-post shortcode excerpt Wordpress

Category Web


Its been almost a decade but just in case anyone else looks this up...there is a parameter excerpt_size that you can add in the shortcode.

Example: [ catlist name=mycategory orderby=date order=desc excerpt_strip=no excerpt_size=857 ]


You need to have

'excerpt' => 'yes',
'excerpt_size' => '100',
'content' => 'no'

... when get_excerpt runs. You can set $params like that but what you posted is not all of the code. It is using $this which means it is part of a class (or you'd get errors). Somewhere in that class something might be altering the defaults, and I suspect something does. If that doesn't work you need to edit your question to provide more of the code.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.