Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #412986

    Hi how can we remove […] from excerpts?
    thanks in advance

    #412991

    Hi pixallus!

    Please add following code to Functions.php file in Appearance > Editor

    function change_excerpt($text)
    {
    return rtrim($text,'[...]');
    }
    add_filter('get_the_excerpt', 'change_excerpt');

    Regards,
    Yigit

    #412998

    added to child theme functions.php and now its displays :
    [&hellip

    #413007

    Hi!

    Can you please change the code to following one

    function change_excerpt($text)
    {
    return rtrim($text,'');
    }
    add_filter('get_the_excerpt', 'change_excerpt');

    Best regards,
    Yigit

    #413010

    now it’s back to: […]

    #413035

    Hi!

    Thank you for coming back.

    Replace the code above with the following:

    
    function change_excerpt( $text )
    {
    	$pos = strrpos( $text, '[');
    	if ($pos === false)
    	{
    		return $text;
    	}
    	
    	return rtrim (substr($text, 0, $pos) );
    }
    add_filter('get_the_excerpt', 'change_excerpt');
    

    Best regards,
    Günter

    #413055

    this worked fine. thank guys!

    #413094

    Hey!

    Glad we could help you. Enjoy the theme.

    Cheers!
    Günter

    #413100

    how can we keep the … but remove only [ ] ?

    #413104

    Hey!

    Use the following code:

    
    function change_excerpt( $text )
    {
    	$pos = strrpos( $text, '[');
    	if ($pos === false)
    	{
    		return $text;
    	}
    	
    	return rtrim (substr($text, 0, $pos) ) . '....';
    }
    add_filter('get_the_excerpt', 'change_excerpt');
    

    Cheers!
    Günter

    #413119

    excellent!

    thanks again!

    #413123

    Hi!

    Have a nice day and feel free to come back with further questions.

    Regards,
    Günter

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘removing […] from excerpts’ is closed to new replies.