• Resolved wifsster

    (@wifsster)


    I would like to add either a “read more” or “continue reading” to some of my posts. I have seen plugins that do this, but I can’t seem to get them to work. I was wondering if there is something with the Customizr Template that prevents this from working.

    I would love to hear a solution or an idea if anyone has one.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @wifsster
    add this function

    function new_excerpt_more($more) {
       global $post;
       return ' <a href=" ' .get_permalink($post->ID). '" class="read-more">' . 'Read more >' . '</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    to functions.php file in your Customizr child theme folder.

    Thread Starter wifsster

    (@wifsster)

    Thank you @tomaja, it’s working intermittently, Could be because some of my blog articles are very short, however the first article in my blog is quite long and the “read more” link is not showing there. I’ve added the link to the blog below for you to take a look. Your assistance is greatly appreciated.

    https://www.wifss.ucdavis.edu/?page_id=17

    If you are using manual excerpts you need to add the following code(i mean if you are using excerpt meta box),

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

    If you are using both types(Generated and manual) you need to add like this whole code in functions.php of child theme:

    <?php
    function childtheme_excerpt_more($more) {
       global $post;
       return ' ';
    }
    add_filter('excerpt_more', 'childtheme_excerpt_more');
    
    function childtheme_excerpt_read_more_link($output) {
     global $post;
     return $output . '<a href="'. get_permalink($post->ID) . '"> Read More...</a>';
    }
    add_filter('the_excerpt', 'childtheme_excerpt_read_more_link');
    
    ?>
    Thread Starter wifsster

    (@wifsster)

    Thanks to you both @tomaja and @bravokeyl , it’s working great, You are greatly appreciated.

    -@wifsster

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding "Read More" Links to posts’ is closed to new replies.