Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

Fixing the Read More Tag Problem in WordPress Static Pages

Last updated on by
Elegant Themes
Fixing the Read More Tag Problem in WordPress Static Pages

WordPress has two ways of showing excerpts in a blog. One is by using the_excerpt() tag in your themes, and the other method is by using the more tag. The more tag allows you to specify where the cut off point is in a post while writing a post which makes it easy for the editor and allow you to show teaser content and such. However the more tag is used only on the home page which shows the latest posts. It does not work in Pages. Recently we encountered this issue and thanks to the WordPress forums we found the solution. If you want to turn on the read more tags in pages for showing partial posts, use the following code inside the loop:

<?php
global $more;
$more = 0;
?>
//The code must be inserted ahead of the call to the content

<?php the_content('Continue Reading'); ?>

That’s it. If any of you theme designers ever get into this issue, then this should be a quick fix.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. KJ says:

    Hey there, I used this fix and it worked….but now the snippet of my post that would’ve been cut off attaches itself to the bottom of the post, and Continue reading doesn’t create and excerpt, it just places a link and continues onto the full post. Any suggestions? Thanks!!

  2. Mark McGlasahn says:

    The problem with too many people will to make a blog post is when they decide to give people advices half of their explanation is missing. If a person knew nothing about wordpress and wanted this to work for him or her, how would what you’ve written help them?
    If you really wanted to help people you’d take the time to explain where the code has to be written and how you get to where the code is written.

    • Editorial Staff says:

      This article is written in the themes category. We figure if you are looking in the theme tutorials, you have a fair understanding of how WordPress works.

      • Leann says:

        I read this and I fall into the “I googled for this problem but don’t understand the answer”.

        Can you please explain where in wp I would put this? And then what do I put on my page?

        So close to a solution but I have no idea how to do this..

        Thanks!

      • Bob says:

        How arrogant of you.

        At the very least you should identify the file to be edited and the loop you’re discussing.

        Saying “nyah nyah, go learn more about WordPress” is childish.

        • Editorial Staff says:

          Bob, sorry that you think we are being arrogant, but hopefully this response will clarify our first response.

          The file that you will paste the code in will vary from one person to another. This problem will only occur when you try to create a “custom page template” where you want to display other posts with content teasers. This functionality is NOT needed in most cases because WordPress has various ways to display archives (i.e categories, tags, dates). Only in custom cases, you will want to have this functionality.

          It is impossible for us to determine what you are going to call your custom page template file. It could be joes-infinity-content.php for all that matter.

          Furthermore, this is not for beginners. Because in order for you to run into the issue we are trying to solve in the post above, you have to learn how to do few other “code” related things (i.e create a custom page template, and know how to use the loop to display a list of posts on that page). By the time you have done all that, then you would know exactly which file you need to put the code in, and exactly where the loop is.

          This problem does not exist by default. The fact of the matter is that a beginner will NOT have this issue to begin with unless you do the two other dev things. Hopefully that makes sense.

    • Phil Stone says:

      I could not agree MORE. This is for beginners? You don’t remember you days as a beginner or you are being too lazy. If you are going to do something, then do is Right or don’t.

      • Editorial Staff says:

        Hello Phil,

        Not sure if you read the comment reply we had for Bob. This is not for beginners. Because in order for you to run into the issue we are trying to solve in the post above, you have to learn how to do few other “code” related things (i.e create a custom page template, and know how to use the loop to display a list of posts on that page). By the time you have done all that, then you would know exactly which file you need to put the code in, and exactly where the loop is.

        This problem does not exist by default. The fact of the matter is that a beginner will NOT have this issue to begin with unless you do the two other dev things. Hopefully that makes sense.

  3. Mark Pasay says:

    Sorry got links in there again…

    Thanks for the reply… I agree it is supposed to do that but it doesnt….

    I setup a test page here westbankfreehomeinfo (dot) com/read-more-test/

    and as you can see the “continue reading” link shows fine with a link url of westbankfreehomeinfo (dot) com/read-more-test/#more-125

    but when you click on it the additional text doesn’t show up

    Thanks so much for your help

    Mark

    • Editorial Staff says:

      You are not using it properly. This trick will not work when you try to show the content of page X on Page X. This trick will only work when you are trying to display excerpts of Page X on Page Y. Hope that helps.

      • Mark P says:

        OK… cool… I’m sorry but I am not sure how to do that. Where do I put the link to take them from page X to page Y? Thanks so much for your patience with me on this…

        Mark

  4. Mark Pasay says:

    Hi there I left a comment yesterday trying to get help on the “read more” tag. I left a link to my site but think maybe you deleted my comment because you thought I was hoping for a backlink…

    I truly need help with this so will try again with no website address… when I add the code to domain.com the “continue reading” link does appear on my page and the content ends where it is supposed to but when I click on “continue reading” the additional content does not appear…

    I am sure I am just missing a step somewhere but cant figure it out… could you please help me understand how I get the rest of the content to show up once the link is clicked???

    Thank-you

    Mark

  5. Flavia says:

    You guys, rock!
    I’ve been looking for a solution for days now and yours is the first one that actually works!
    Thanks

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.