Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello @zabavljaev

    Yes, we do have an option to enable the Excerpt content or Full Content.

    I hope that helps. Or let me know if we haven’t understood your query.

    Regards,
    Suman

    Thread Starter zabavljaev

    (@zabavljaev)

    Thanks! I know about these settings. But I have posts where there is a little text and there is also a custom template where there is no text at all. In this case, you can only click on the title, but I wanted the link “read more” also to be. The link also does not appear if I fill out the “excerpt” field on the post editing page. But I would like the link to be there too.
    I am just an amateur and do not know some things. Sorry if I ask questions that are not directly related to Astra!

    • This reply was modified 4 years, 9 months ago by zabavljaev.

    Hello @zabavljaev

    I am not sure if we have clearly understood your query.

    Do you have posts that do not have the required word count and need to display the Read More button?

    If so, we use the default WordPress filters which displays the Read More after the post has the expected word count. So the post will need to have the required word count of 55 words.

    While we do have actions called astra_the_excerpt_after under which you can pass the button to the respective posts and their title can you try this?

    I hope that helps. Looking forward to hearing from you!

    Regards,
    Suman

    Thread Starter zabavljaev

    (@zabavljaev)

    Thanks! You understood me correctly. I could change the number of words by applying a filter:

    add_filter( 'excerpt_length', function($length) {
        return 20;
    } );

    But I need the link to be shown for any number of words, as well as for their absence. Could you show how to use “astra_the_excerpt_after”?

    Thread Starter zabavljaev

    (@zabavljaev)

    Please see if this can be done this way:

    function new_excerpt_more($more) {
        return '';
    }
    add_filter('excerpt_more', 'new_excerpt_more', 21 );
    
    function the_excerpt_more_link( $excerpt ){
        $read_more_text    = apply_filters( 'astra_post_read_more', __( 'Read More »', 'astra' ) );
        $excerpt .= '<p class="read-more"><a class="my-read-more" href="'. get_permalink( get_the_ID() ) . '">' . $read_more_text . '</a></p>';
        return $excerpt;
    }
    add_filter( 'the_excerpt', 'the_excerpt_more_link', 21 );

    I’m afraid to do something stupid …

    Thread Starter zabavljaev

    (@zabavljaev)

    If I set empty for excerpt_more, then there will not be three dots (…).
    I don’t know how important screen-reader-text is, but it’s very noble of you to do this.

    Hello @zabavljaev

    Yes, you have done the right thing. While we are not sure, about the last response.

    Looking forward to hearing from you!

    Regards,
    Suman

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Read more post link is always there’ is closed to new replies.