Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1259752
    yhshin1020
    Participant

    Hey,

    I am trying to add a “read more” link after the excerpt on my blog entry feature.

    I’ve gotten an answer from other threads (including my own a few months ago) but none of the codes worked.

    How can I add this successfully?

    Thanks.

    #1259753
    yhshin1020
    Participant
    This reply has been marked as private.
    #1259941
    Nabeel A
    Moderator

    Hi There,

    Thank you for writing in! Please add the following code in your child theme’s functions.php file:

    // Adding Excerpt to Posts 
    function excerpt_read_more_link($output) {
       global $post;
       return $output . '<a href="'. get_permalink($post->ID) . '"> Read More</a>';
    }
    add_filter('the_excerpt', 'excerpt_read_more_link');

    Let us know how this goes!

    #1260417
    yhshin1020
    Participant
    This reply has been marked as private.
    #1260562
    Darshana
    Moderator

    Hi there,

    #1. Use the following CSS rule instead.

    .blog .entry-content > p::after {
        content: " ...";
    }

    #2. Then update the following code in your functions.php file.

    
    // Adding Excerpt to Posts 
    function excerpt_read_more_link($output) {
       global $post;
       return $output . '<a class="my-readmore-link" href="'. get_permalink($post->ID) . '"> Read More</a>';
    }
    add_filter('the_excerpt', 'excerpt_read_more_link');
    

    Then add the following custom CSS rule to change the color of your read more link.

    
    .my-readmore-link {
        color: red;
    }
    

    Hope that helps.

    #1260617
    yhshin1020
    Participant

    You’re the best.

    Thanks

    #1260625
    Friech
    Moderator

    We’re delighted to assist you with this, should you require any further assistance with X|THEME and Cornerstone, please feel free to get in touch with us.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1259752 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>