The “More” Tag on a WordPress Page
If you like this post, please subscribe to our RSS feed to read our new posts every day.
Nathan Rice wrote about WordPress’s ability to make any page a homepage. One problem I ran into using the technique of pages was the inability to use the <!--more--> tag to display partial posts. Apparently this is default behavior (for good reason) on pages. However, when using Nathan’s technique, I found myself in a unique situation where I only wanted to show a partial post (on a page) if the post was making use of the <!--more--> tag (apparently, I’m not alone).
The technique is rather simple. Simply declare a variable named $more as a global and set it to false right before showing your content. If you wish to resume normal behavior after the content is shown, simply set the variable back to true.
<?php global $more; $more = false; ?> <?php the_content('Continue Reading'); ?> <?php $more = true; ?>
Visitors who read this post, also read:
Related posts from the past
- Define Your Own WordPress Loop Using WP_Query
- Paging and Custom WordPress Loops
- How To: Avoid Duplicate Posts
- How to Only Retrieve Posts With Custom Fields
- Global Variables and the WordPress Loop
- Reduce the Size of Your WordPress Plugin Footprint
- How to: Offsets and Paging
- Fading Into View.
- WP-Plugin: Bad Behavior Stats v2.1
- Managing Trackbacks and Pingbacks in Your WordPress Theme

(17 votes, average: 4.53 out of 5)











Comments RSS
Newb here - With WP’s ability to make any page a homepage, can one make more than one page (within a given WP blog) a ‘homepage’ and make use of multiple domain names (not subdomains) for each one of those ‘homepages?’
[Reply]
Marc — 07/9/2007 @ 10:35 pm@marc-
that relies on your hosting configuration, not wordpress. it depends from host to host.
[Reply]
adam (39 comments.) — 07/9/2007 @ 11:33 pmRon,
I actually had a client ask me for something similar … and I opted to use a page excerpt instead of using the more tag (although either option is fine). I used the page excerpt plugin here:
http://blog.ftwr.co.uk/wordpress/page-excerpt/
It adds an “optional excerpt” field to the page edit screen that you can put anything in. Just call the_excerpt like you would for a post, use query_posts and the loop to specify the page to call, and you’re done.
Oh, and if you were looking for a site to link to for my name, you can just like to rockinthemes.com
Thanks for the hat tip, by the way
[Reply]
Nathan Rice (3 comments.) — 07/9/2007 @ 11:59 pmwait, what? I’m lost.
[Reply]
Jenny (24 comments.) — 07/10/2007 @ 11:23 amJenny,
If you are using a page instead of index.php as your main page on a WordPress install, this technique allows you to use the “more” tag. I would follow Nathan’s example over at Blog Herald and go from there as needed.
[Reply]
Ronald Huereca (39 comments.) — 07/10/2007 @ 12:29 pm@Ronald
Awesome hack. Will put this in the recipe book for future use.
@Nathan
Sheesh, I wish I’d known about that plugin a year ago! I’ve been manually adding my “excerpts” to pages (I use the excerpt as a sub-heading.)
[Reply]
Jonathan (81 comments.) — 07/10/2007 @ 7:35 pmMan. Wish I’d known this three or four months ago.
I had a client who needed “articles” published on one page and “tips” published on another, with editable text before the individual posts, which they wanted shortened with more–so I created a page template, not knowing that the more tag wouldn’t work. Ended up just using categories.php along with category description before the posts instead of the page template and page content itself.
[Reply]
Vincent (1 comments.) — 07/11/2007 @ 9:52 pmI fail to see why that would work. I mean, what does the more link to, and what happens when you click on it? I would expect that it would link to the page’s permalink, but when you click on it, you’re going to get that same thing (since you’re using a page template) and the more link is just going to display again.
How do you view the content after the more link in this situation?
[Reply]
Otto (64 comments.) — 07/12/2007 @ 4:31 pmThanks for passing along and sharing an excellent tip, Mark! I am in the middle of developing several sites, including a large organization site using WordPress as a CMS platform, and this was a challenge recently identified. The tip came made the solution simple.
Cheers!
Dave
[Reply]
Dave J. (Scoop0901) (5 comments.) — 07/12/2007 @ 5:57 pmOtto,
If you use the technique without doing a “query_posts” first, then you’ll get the result you mentioned in your comment. I referenced Nathan’s article at the beginning of the post, so I’m assuming you’re trying to do something similar.
[Reply]
Ronald Huereca (39 comments.) — 07/12/2007 @ 6:53 pmOtto,
Looks like Ronald beat me to it, but I’ll elaborate a bit more. This tip is talking about homepage design … not page.php design. You’re right, using the more tag on a single page would be silly. But on the homepage, it can be used to handle things like an “about me” box in the sidebar that gives an excerpt of your about page, then links to the rest. The possibilities are endless when it comes to using WP as a functional CMS.
Nathan
[Reply]
Nathan Rice (3 comments.) — 07/12/2007 @ 7:08 pm[...] This plugin enables bloggers who wish to use a ‘page’ as the homepage of a WordPress blog. For more information on pages, visit the BlogHerald’s article on making any page the homepage. Also visit my article on using the “more” tag on a WordPress page. [...]
WP From the Vault » Reader Appreciation Project — 08/6/2007 @ 8:02 pmi am a newbie to the wordpress, and i face the same problem you mentioned then i found your article here so thanks for the tips first, but, i still dont know how to solve that problem in your way,i don’t know where i can put your code in, is it in the page.php or in the template page that i created for my own homepage?
or can you email me the detailed solution? thanks so much
[Reply]
dizzah — 09/9/2007 @ 10:18 amdizzah,
Check out Nathan Rice’s article. You can also check out my article on the loop.
The WordPress codex will be your new best friend. The WordPress codex is a good resource for information on WordPress pages.
What you will have to do is create a new page template, and put the code I mentioned within the loop. You will then have to create a new page within WordPress and use the page template you created as a template. From there, you will have to tell WordPress to use your page as the default home page (Options -> Reading) and go from there.
I hope that helped.
[Reply]
Ronald Huereca (39 comments.) — 09/9/2007 @ 12:20 pmThank you, this was really useful. I couldn’t get the more tag to work anywhere within the theme I’m using, but this solved that problem.
[Reply]
Leo (1 comments.) — 02/25/2008 @ 4:40 pmThank You! This saved my day
[Reply]
Thomas Gigold (1 comments.) — 02/27/2008 @ 4:59 pm[...] tag to clip posts on any pages other than the specified homepage. So, I did a little searching and found a really simple fix for this problem over at Weblog Tools Collection. [...]
The Read More Link on WordPress Pages | Wordpress Hacker — 10/19/2008 @ 4:53 pm