WordPress.org

Ready to get started?Download WordPress

Forums

[Theme: Adapt 2.0] Excerpts: Remove dots (...) (1 post)

  1. ramo24
    Member
    Posted 9 months ago #

    Dear Community,

    I want to remove the three dots in the end of excerpts. I tried nearly everything, like adding this to functions.php:

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

    As well I installed an addon for configuring excerpts - doesn't work. Now I think maybe it doesn't work because of the theme Adapt 2.0 by WPExplorer. It has an own excerpts.php file:

    <?php
    /**
     * Custom excerpts based on wp_trim_words
     * Created for child-theming purposes
     *
     * Learn more at http://codex.wordpress.org/Function_Reference/wp_trim_words
     *
     * @since 2.0
    */
    if ( !function_exists( 'wpex_excerpt' ) ) :
    	function wpex_excerpt($length=25, $readmore=true ) {
    		global $post;
    		$id = $post->ID;
    		$meta_excerpt = get_post_meta( $id, 'wpex_excerpt_length', true );
    		$length = $meta_excerpt ? $meta_excerpt : $length;
    		if ( has_excerpt( $id ) ) {
    			$output = $post->post_excerpt;
    		} else {
    			$output = wp_trim_words( strip_shortcodes( get_the_content( $id ) ), $length);
    			if ( $readmore == true ) {
    				$readmore_link = '<br /><a href="'. get_permalink( $id ) .'" title="'. __(' weiterlesen', 'wpex' ) .'" rel="bookmark" class="readmore-link">'. __(' weiterlesen', 'wpex' ) .' →</a>';
    				$output .= apply_filters( 'wpex_readmore_link', $readmore_link );
    			}
    		}
    		echo $output;
    	}
    endif;
    
    /**
    * Change default read more style
    * @since 2.0
    */
    add_filter('excerpt_more', 'wpex_excerpt_more', 'get_the_excerpt', 'trim_excerpt');
    if ( !function_exists( 'wpex_excerpt_more' ) ) :
    	function wpex_excerpt_more($more) {
    		global $post;
    		return ('...'); // removing this dots doesn't change anything
    	}
    endif;
    
    /**
    * Change default excerpt length
    * @since 2.0
    */
    add_filter( 'excerpt_length', 'wpex_custom_excerpt_length', 999 );
    if ( !function_exists( 'wpex_custom_excerpt_length' ) ) :
    	function wpex_custom_excerpt_length( $length ) {
    		return wpex_get_data('excerpt_length','25');
    	}
    endif;

    Maybe someone can help me with this problem?

    Thank you very much!

Reply

You must log in to post.

About this Topic