This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Excerpt read more link

  • Creator
    Topic
  • #17253
    mike-se
    Participant

    Hi guys!

    I can add a “Read more” link after the post excerpt via the functions file:

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

    This puts the read more link […] below the excerpt in a separate paragarph. Is it possible, via the function to place it right after the last word in the excerpt?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #17288
    Jason Bobich
    Keymaster

    Hello,

    I think you just need to filter it onto the_excerpt before wpautop. You do this by passing in a priority. By default it’s 10. Try filtering in at priority 5 or some number less than 10.

    add_filter('the_excerpt', 'excerpt_read_more_link', 5);
    #17289
    mike-se
    Participant

    That did it – Thanks!

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

You must be logged in to reply to this topic.