[resolved] Read More link troubles (3 posts)

  1. adejones
    Posted 3 years ago #

    This "read more" function is something I seem to struggle with on every site I do and finally want some clarification.
    In my post I have put a line of text, then <-- more --> and then another line of text.
    In the blog page template, I have the_content(); and in my functions.php I have

    function my_more_link($more_link, $more_link_text) {
    	return str_replace($more_link_text, 'Keep reading this post', $more_link);
    add_filter('the_content_more_link', 'my_more_link', 10, 2);

    In theory, this function should insert "Keep reading this post" at the point of my <-- more --> right? Well it doesn't, I still just get the full post.

    Any help please?

  2. Michael
    Forum Moderator
    Posted 3 years ago #

    I still just get the full post

    the 'more tag' only automatically works in index and archive pages;

    what template are you referring to?


  3. adejones
    Posted 3 years ago #

    Just got it, had to insert

    global $more;
    $more = 0;

    Will record this for future use haha


Topic Closed

This topic has been closed to new replies.

About this Topic