• Resolved zenframe

    (@zenframe)


    Plugin works great, only issue I have found so far is that it places […] at the end of every excerpt. I can’t find anyway to turn it off or change it and it’s triggering me massively.

    Is there anyway to turn it off without my resorting to hacking the generated HTML with jQuery?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @zenframe,
    That is the default WP excerpt.

    Here is a function I use on my sites.

    // Add to functions.php
    function alm_get_excerpt($limit, $after = null) {
    	$excerpt = explode(' ', get_the_excerpt(), $limit);
    	if (count($excerpt)>=$limit) {
    		array_pop($excerpt);
    		$excerpt = implode(" ",$excerpt).'...';
    	} else {
    		$excerpt = implode(" ",$excerpt);
    	}
    		$excerpt = preg_replace('<code>[[^]]*]</code>','',$excerpt);		
    	if($after)
    		$excerpt = $excerpt . $after;
    	
    	if($excerpt)
    		echo '<p>'.$excerpt.'</p>';
    }

    Then call the following in your template.
    alm_get_excerpt(30);

    Hope this helps.

    Thread Starter zenframe

    (@zenframe)

    Hi @dcooney,

    Thanks for the reply, your function didn’t work, but the get_the_excerpt() call put me on the right track. I eventually used this to make the replacement:

    function trim_excerpt($text) {
    	$string = "[...]";
         $text = str_replace( $string, '', $text);
         return $text;
        }
    add_filter('get_the_excerpt', 'trim_excerpt', 99);
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove or change format of excerpt ellipsis’ is closed to new replies.