Post Excerpts and the More Tag in WordPress

Not only once, it has been said that displaying full posts on your blog home page, category pages or archive pages increases the chance of being penalized for duplicate content.

In WordPress, using post excerpts has proven to be a good alternative, but one that has its downsides:

  • You lose control over text formatting;
  • Images won’t be displayed;
  • If you don’t take time to write them yourself, WordPress might not select the most appropriate fragments;
  • Readers might not be convinced to further click, if the excerpt is not attractive enough.

Better Post Excerpts

If you’re concerned about your writing style, you’ll most definitely take care about how you structure your posts, where you insert images and how you write the introductory paragraph.

With these in mind, you basically got yourself a very good post excerpt, one that you should not leave to WordPress to decide when and where to cut.

The ‘More’ Tag

This is the most valid alternative to displaying post excerpts, if the_excerpt() template tag does not fit your needs.

More is what the WordPress developers call a quicktag, designed to cut-off large posts into two fragments: one that will be displayed as an excerpt and one that users will continue to read from after clicking the “read more” link. It serves as a marker inside the post so that users who come from the excerpt link, will start reading the content from that point on, and not from the beginning, again.

What this quicktag actually represents is a HTML comment that WordPress translates a the cut-off point. To use it while editing your posts in HTML view, you simply need to add this where you want the post cut:

Your introductory paragraph should be placed before using the 'more' quicktag.
That way it will act as a post excerpt.
<!--more-->

Using it like in the above example will return a post excerpt similar to this:

Your introductory paragraph should be placed before using the ‘more’ quicktag.
That way it will act as a post excerpt. more…

Customizing the ‘more’ link

The default text (more…) is not very attractive, right? I mean, you must really be interested in the rest of the story to click it.

But fear not, there are many ways in which you could customize the link, applying a global or single post effect. Described below are two methods you could use.

Method One: Customizing the_content() template tag

Effects: Global
Requirements: Minor coding knowledge

As per default, posts excerpts are displayed by using the_excerpt(), while full posts are displayed through the use of the_content() tag.

If you take a look at the code of your theme’s index.php file, and of course if it uses full posts, you’ll notice a line of code similar to this one:

<?php the_content(); ?>

The easiest way to customize it and obtain a global effect would be by adding a parameter containing your own ‘read more’ text, as shown in the example below:

<?php the_content(' Continue reading this post!'); ?>

The end result will look similar to this:

Your introductory paragraph should be placed before using the ‘more’ quicktag.
That way it will act as a post excerpt. Continue reading this post!

To further more customize the link, you can even use HTML code and add CSS classes to it:

<?php the_content(' Continue reading this post!'); ?>

or use WordPress’ get_the_title() template tag to add the post name inside the link, like this:

<?php the_content(' Continue reading '.get_the_title()); ?>

Assuming the example of my own post title, this will result in something similar the this:

Your introductory paragraph should be placed before using the ‘more’ quicktag.

That way it will act as a post excerpt. Continue reading Post Excerpts and the More Tag in WordPress

Of course, you could always use a combination of HTML tags and WordPress template tags to further customize the link, as long as you keep in mind that the effect will be global (will apply to all posts using the more quicktag).

Method Two: Customizing the <!--more--> quicktag

Effects: Single post
Requirements: Nothing a 5 year old won’t manage

Assuming you have adjusted the link to your needs by using the above described global-method and on some posts you need to tweak the link more, the best way to customize the display text is my adding it to the <!--more--> quicktag, as shown below, in your post HTML view:

<!--more This is my custom more text-->

This will result in:

Your introductory paragraph should be placed before using the ‘more’ quicktag.
That way it will act as a post excerpt. This is my custom more text

Note: The results of this method override the defaults or the effects of the first method and only affect the text, and not the formatting.

That’s it!

Easy as one, two, three, right? Happy customizing! And in case you need more information, here are a few links from the WordPress Codex:

More Blogsessive Content

This article has 7 comments

  • I am using “more” separator at my blog and it works excellent.

    Only one minor issue with it that “more” link scrolls to separator when opening single post page. Some people dislike that. I have seen plugin that disables that anchor but not using it yet (as always I am trying to keep things simple).

  • Completely agree with you. Most people really don’t know that if you put “Read more about TITLE” or something like that you actually strengthen the link, thus helping in seo optimization for direct access to the linked page.

  • Rarst: I don’t see the auto-scroll as a downside. Basically, after you’ve finished reading the post excerpt, you’re supposed to continue reading from where you left off, in our case, from the “more” marker.

    Stefan: Indeed, there are SEO advantages too with using that method.

  • Thank you for this post. Personally i prefer the more-link method because it is customizable for every single post.
    @Rarst (and all) Nevertheless the underlying link structure is NOT customizable, so i’ve written a small plugin (http://wordpress.org/extend/pl.....-morelink/) to reconstruct the link structure the way you want – remove #more-anchor, remove/add css class(es), add nofollow – whatever you want. The filter takes the original more-link from the content, extracts the important parts and replaces the link with a pattern you can define in the admin panel.

  • Hi Alex,

    Does Wordpress keep php from executing in template files other than the header? Here is why I ask.

    I am trying to track some advertising to my blog, so I setup unique urls similar to:
    http://www.myblog.com?kw=2

    I then included this at the top of my template page header.php.

    Then when I attempted to echo the value for kw in my theme using , it didn’t work. It would only work if I tried to echo in the header and wouldn’t work in the sidebar.php or any other theme files.

    Is there a way to work around this?

    Thanks,

    Brent

  • opps, it blocked my code.

  • Craig Mullins

    I am curious if you have something like this:

    <?php the_content_limit(380, “Continue Reading: &raquo &raquo ” . get_the_title(”, ”, false)); ?> /div>

    How would you nofollow the continue reading part of the link.

    If you reply would you mind emailing me the answer? :)

Add a comment

Submit comment!

Let's play nice! Comments are all about conversation. How am I supposed to address you if you use keywords as your name?
Not to mention that you risk having your comment spammed or deleted.
I would really appreciate it if you use your name or pseudonym.

2 blog posts linking to this article

  1. 10 things I hate about your site » Blog Archive » 10 things: Willem’s Internet Blog
  2. 10 things I hate about your site » Blog Archive » 10 things: Let’s All Go to the Movies!!!!