Support » Plugin: Network Latest Posts » [Plugin: Network Latest Posts] Excerpt length

Viewing 1 replies (of 1 total)
  • Plugin Author Jose Luis SAYAGO

    (@iluminatus)

    Hi,

    If you want to limit by chars you have to replace the nlp_custom_excerpt function from the file network-latest-posts.php on line 885 by this one:

    function nlp_custom_excerpt($count, $content, $permalink, $excerpt_trail){
        if($count == 0 || $count == 'null') { $count = 55; }
        /* Strip shortcodes
         * Due to an incompatibility issue between Visual Composer
         * and WordPress strip_shortcodes hook, I'm stripping
         * shortcodes using regex. (27-09-2012)
         *
         * $content = strip_tags(strip_shortcodes($content));
         *
         * replaced by
         *
         * $content = preg_replace("/\[(.*?)\]/i", '', $content);
         * $content = strip_tags($content);
         */
        $content = preg_replace("/\[(.*?)\]/i", '', $content);
        $content = strip_tags($content);
        // Limit the number of characters
        $content = substr($content, 0, $count);
        $content = $content . '...';
        // Add the trail
        switch( $excerpt_trail ) {
            // Text
            case 'text':
                $content = $content.'<a href="'.$permalink.'">'._('more').'</a>';
                break;
            // Image
            case 'image':
                $content = $content.'<a href="'.$permalink.'"><img src="'.plugins_url('/img/excerpt_trail.png', __FILE__) .'" alt="'._('more').'" title="'._('more').'" /></a>';
                break;
            // Text by default
            default:
                $content = $content.'<a href="'.$permalink.'">'._('more').'</a>';
                break;
        }
        // Return the excerpt
        return $content;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Network Latest Posts] Excerpt length’ is closed to new replies.