• I am building a custom theme and am experiencing some unexpected behavior with the_excerpt…

    I know that you have to use:
    global $more; $more = false;
    to get the more tag to break content that is not in the main loop.

    I am only able to get the “more” link when the page uses the auto-generated excerpt. If I use the more tag to shorten the content or I use the manual excerpt field, the content breaks where expected but I do not get a more link. If I shorten the excerpt length to 2 words (to test) then I get a more link for the content that breaks with the more tag (because it is forced to break before the more tag) but I do not get a more link for the manual excerpts. I wasn’t aware that the manual excerpt would not create the more link, but I know that adding the “more tag” to a post should break the content and produce a more link…not just break the content.

    Any ideas?

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I know that you have to use:
    global $more; $more = false;
    to get the more tag to break content that is not in the main loop.

    No – that’s incorrect. You only need to use that when you want t use the more tag in static Pages. It should always work in Post when using in conjunction with the_content().

    the_excerpt() does not make any use of the more tag or the $more variable.

    So – which are you using – the_content() or the_excerpt()?

    Thread Starter smeyer012

    (@smeyer012)

    Grr. So I replied to this earlier and don’t know what happened to it. ??

    I am using “the_excerpt” within a custom query for a custom post type in a page template. If I don’t use global $more; $more = false; then the posts no longer break at the more tag.

    I usually utilize the auto-generated excerpt, but in this case, the client needs to show teaser text in the feed, while the rest of the post content is restricted to members. The teaser text could be any length, so I can’t auto-generate it. I’d like them to be able to use the excerpt field or the more tag to control what is seen, but I can’t get a more link with either of those at this point.

    Most feeds ignore the more link and show the whole post.

    Thread Starter smeyer012

    (@smeyer012)

    I realize that most feeds show the whole post, unless it is called with the_excerpt. Even still, you need global $more; $more = false; to make it break with the more tag.

    Anyone have any ideas on what to do?

    Thread Starter smeyer012

    (@smeyer012)

    If I change my template to utilize the_content, I get a more link at the more tag break, so I’m assuming the more tag just won’t work as I’d like with the_excerpt.
    For anyone who might be experiencing the same issue, I found this article very useful for producing the more link for manually entered excerpts:
    https://beingzoe.com/2069/2011/07/wordpress-snippet-always-show-a-read-more-link-using-the_excerpt/

    Thus I will set a short word limit for the excerpts used within my page template and tell the client to utilize the excerpt field to control what is displayed.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘more link not appearing in feed’ is closed to new replies.