Support » Plugin: Advanced Excerpt » read_more custom link not working

  • Hi Chris!
    I’m still using this most excellent plugin frequently, especially after you created the filter for me last year!
    I have run into a situation where I want to display the already filtered read_more text link, but am unable to get it to work.
    I have tried:
    the_advanced_excerpt('read_more="Read More&length=0&ellipsis=');
    the_advanced_excerpt('read_more=Read More&length=0&ellipsis=');
    (with and without quotes around read more text).
    I’m using a filter:
    (using a modified version of the “Pirates Ahoy” plugin.)
    and the following filters:

    function ae_read_more_template( $permalink, $read_more ) {
    	global $post;
    	return ' <a href="%1$s" title="' . get_the_title( $post->ID ) . '" class="read-more">%2$s</a>';
    add_filter( 'advanced_excerpt_read_more_link_template', 'ae_read_more_template', 10, 2 );
    function ae_only_add_more_when_required( $default, $text, $options ) {
        $text = strip_tags( $text );
        if ( 'words' === $options['length_type'] ) {
            $excerpt_length = str_word_count( $text );
        } else {
            $excerpt_length = strlen( $text );
        if ( $excerpt_length > $options['length'] ) return $default;
        return true;
    add_filter( 'advanced_excerpt_disable_add_more', 'ae_only_add_more_when_required', 10, 3 );

    What am I doing wrong?

Viewing 1 replies (of 1 total)
  • Plugin Author WPKube


    Hi @brianbrown

    the_advanced_excerpt function also accepts an array for the parameters.

        'read_more' => 'Read More',
        'length' => 0,
        'ellipsis' => ''

    It’s a bit easier to make changes that way.

    But I’m not sure I understood the issue you are having. What are you getting when you use the function and what is the expected result you want?

Viewing 1 replies (of 1 total)
  • The topic ‘read_more custom link not working’ is closed to new replies.