• djr3110

    (@djr3110)


    Hi, I have set my archive page to show the excerpt automatically effectivelly allowing WP to truncate the post after 55 words. All that is cool, but I have comments from some readers that the […] symbol at the end of the excerpt does hyper link to the post. Unlike the more tag method. Does anyone know how I can make the […] hyperlink to the post or indeed if I can add Read More using the_excerpt fuction.

    Any help would be great

Viewing 2 replies - 1 through 2 (of 2 total)
  • stvwlf

    (@stvwlf)

    Hi

    Here’s some code someone posted the other day that does just that

    Replace Excerpt […] ellipse with user-defined text
    (put in functions.php)

    function excerpt_ellipse($text) {
       return str_replace('[...]', ' <a href="'.get_permalink().'">Read more...</a>', $text); }
    add_filter('the_excerpt', 'excerpt_ellipse');

    If, however, you are writing your own excerpts and want to add a Read More permalink, replace:
    <?php the_excerpt(); ?>
    with this:
    <?php the_excerpt(); ?><span class="read_more"><a href="<?php the_permalink(); ?>">[ Read More &rarr; ]</a></span>

    Thread Starter djr3110

    (@djr3110)

    That works like a dream and I’ve spent so long trying to find a solution thank you so much

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘the_excerpt’ is closed to new replies.