• I’ve recently noticed that the code I’ve used to redefine the “…” at the end of excerpts has stopped working.

    function child_excerpt_more( $more ) {
    	return ' .... <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">Read More</a>';
    }
    add_filter( 'excerpt_more', 'child_excerpt_more' );

    It now always appears as “Continue Reading –>”

    I’ve finally tracked this down to twentyfourteen v1.3 and a new function twentyfourteen_excerpt_more being defined in template-tag.php….

    if ( ! function_exists( 'twentyfourteen_excerpt_more' ) && ! is_admin() ) :
    /**
     * Replaces "[...]" (appended to automatically generated excerpts) with ...
     * and a Continue reading link.
     *
     * @since Twenty Fourteen 1.3
     *
     * @param string $more Default Read More excerpt link.
     * @return string Filtered Read More excerpt link.
     */
    function twentyfourteen_excerpt_more( $more ) {
    	$link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
    		esc_url( get_permalink( get_the_ID() ) ),
    			/* translators: %s: Name of current post */
    			sprintf( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
    		);
    	return ' &hellip; ' . $link;
    }
    add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' );
    endif;

    The workaround is to use…

    function twentyfourteen_excerpt_more( $more ) {
    	return ' .... <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">Read More</a>';
    }
    add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' );

    …in functions.php instead

  • The topic ‘function twentyfourteen_excerpt_more stops excerpt_more working’ is closed to new replies.