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. Ashwin says:

    I am trying to put a read more… link to my Home Page. However, I can see that the above code worked well in one specific page. But I can see that it is not making any changes on the home page. I am using flexibility 3 theme. Can you please help?

  2. Robert Sean says:

    Short and to the point. This is my first attempt at designing a theme and you just resolved my issue in one easy step, honestly took less than10 seconds. Cheers.

  3. Albert says:

    The instructions are clear, but in what file to insert the code? WP don’t permit me editing the code of any page, only to write a content. If someone could shed some light on this issue…

    • Editorial Staff says:

      You would need to use FTP if you can’t edit the files from wp-admin.

      Also this code would only be needed if you are using page-template to display an archive of other posts. In that case, you would need to paste the code inside the loop. This is an intermediate level tutorial meant for theme designers.

      • Albert says:

        O.K., I see, this concerns only archives, but what about regular pages, sometimes I publish long stories and I would like to offer only a glimpse at the start of the page and with “read more” to evoke the rest of the content. What is the remedy in this situation? What files should I look for? Thanks in advance.

  4. 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!!

  5. 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.

        • Matoca says:

          Guess the website domain name threw me off, “wpbeginner.com” I thought perhaps this website would explain wordpress PHP in a way that a “beginner” could understand. I do use HTML5 and CSS3 so I am not a complete novice. I would like to learn how to design WP too.

          So perhaps you could clarify, is ” something in one of the templates in Appearance>Editor?

          I have read in WordPress docs that the “read more” is not offered by default in pages, but is available for landing pages. Since the “read more” attribute is available in my landing page editor, I have applied it and see it in my text editor I need to understand why it doesn’t display when I refresh the page.

        • WPBeginner Support says:

          Matoca,

          A page is actually a single post in itself. The more tag, is supposed to be used to display an excerpt from an entry and then display a link back to full entry. However, when a user is already on a single page then the more tag will not work because the page will by default show the full content.

          However, if you are using a custom template then you can get the more tag to work by adding this code in your custom landing page template:

          <?php
          global $more;
          $more = 0;
          ?>
          //The code must be inserted ahead of the call the_content, but AFTER the_post()
          
          <?php the_content('Continue Reading'); ?>
          

          This code will only work if you are using your landing page to display a set of posts or pages. It will not work for the page itself because the user is already on the page.

  6. 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

  7. 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

  8. 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.