WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Read More link troubles (3 posts)

  1. adejones
    Member
    Posted 1 year 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. alchymyth
    Forum Moderator
    Posted 1 year 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?

    http://codex.wordpress.org/Customizing_the_Read_More

  3. adejones
    Member
    Posted 1 year ago #

    Just got it, had to insert

    global $more;
    $more = 0;

    Will record this for future use haha

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic