The 2 Methods of Showing Excerpts

Cut Out People
Photo by Linek
There are many reasons to choose to publish either full posts or excerpts on the homepage. Full posts are very simple to implement. You simply write, then publish. However, if you have chosen only partial posts, then WordPress users have two different methods which will achieve the same effect.

Method 1: The More Tag

This method is usually the easiest of the two. When you have written your post, select where you would like to make the cut-off between the partial post for the homepage, and the rest of the page, then click the More button (More).

Your homepage, and category pages, will now display only the first section of the post, and a line of text linking to the rest of the article. This line defaults to, “Read the rest of this entry »”, but can be easily changed. Open your index.php template file, and change the following line: (Make sure you retain the quotation marks!)

<?php the_content('Read the rest of this entry »'); ?>

Method 2: Post Excerpts Function

To use the post excerpts function, you will need to edit your template’s files, namely those controlling your home and category pages (These will be home.php and category.php if you have them, and index.php if you don’t). First off, replace the following line:

<?php the_content('Read the rest of this entry »'); ?>

with:

<?php the_excerpt(); ?>

Your pages will now show the excerpt. However, to load the post, your readers will have to click the post title. This isn’t optimal (Why force your readers to scroll back upwards, to continue reading onwards?) . To solve this, we will add a link below the content, which can be used to load the rest of the article, similar to the one generated by the <!–more–> tag. Beneath the line we just edited, add the following:

<a href="<?php the_permalink(); ?>" title="Read the rest of <?php the_title(); ?>" class="more-link">Read the rest of this entry »</a>

It would also be recommended that you customise the text.

By default, WordPress will now show the first 55 words of your post. You can change this however, by pasting what you want to be shown into the “Optional Excerpt” box in the Write Post screen. This box understands code, so if you intend upon including images in the excerpt, then you can copy and paste directly from the Code View on the Write Post page.

Through using this method, you can choose to display different text on the homepage than what is in the article. For instance, you may want to write a summary of the article to come, not merely quote the introduction. Another use is that if you choose to split the excerpt from the post in the middle of a list, you can add the </ul> tag to the excerpt, to ensure your homepage continues to validate (Not overly important by any means, but it is nice to do).

Both of These Methods Will Publish a Partial RSS Feed

Sadly, WordPress does not natively support the feature of allowing you to continue publishing full-text feeds, when you use either of these methods. However, you can get around this by installing Ronald Heft’s Full Text RSS feed plugin.

And yes, this does mean that Pro Blog Design is returning to full-text feeds! Apologies for sending out partial feeds for the past week or so.

Share

  1. Nice post. I don’t think you really need all those coding though. As long as you set a summary, your excerpts should be fine.

    • Whoopie (4 comments)29 April 10

      i tried the method 1 but no go. it previously worked with coding on index.php on an independent site index.php that just showed excerpt from my blog sub folder in same site. here’s the code .. not sure if it’s correct i had changed it and then the “read more” link didn’t work.

      require(‘wp/wp-blog-header.php’);

      ?>

      in your method one do you need a closing </more tag?

    • Whoopie (4 comments)29 April 10

      sorry. here’s the code within a tag. i hope
      [code]require('Blog25/wp-blog-header.php');

      ?>

      [/code]

    • Whoopie (4 comments)4 May 10

      if i change the template files will the excerpt show up on my independent site. Still crazy after all this time.
      i don’t want to mess all up if it doesn’t work. sorry but i’ve almost had it with wordpress.

    • Whoopie (4 comments)5 May 10

      under which folders are the template files: home.php and category.php if you have them, and index.php. i will try it. i’m determined to get this working. please help. i don’t want to be spoonfed just pointed in the right direction. i think i know what direction you want to point me :>)

  2. kristarella (142 comments)18 August 07

    Oops, feel free to ignore the last comment I left on your previous post then!

  3. Michael Martin (1511 comments)18 August 07

    Sly – The codes are just way of controlling what is shown, and how. :)

    Kristarella – lol. Thanks for pointing it out anyway. That was a mistake on my part. I never intended on partial feeds!

  4. I really appreciate this post.

    Although I already knew about the -more- posting function, I had no idea that the Heft plug existed allowing for full feed posts even if I use the -more- technique.

    I think Heft’s plugin is right on and much needed.

    Judging from his post that you link to, the plugin is very popular and well received.

    Now I can offer partial posts on my blog itself and then send out full feeds to my subscribers.

    Thanks again for pointing us in that direction.

    joseph hollak
    http://www.hollakmedia.com

  5. Michael Martin (1511 comments)18 August 07

    No problem Joseph. I agree that the plugin is an absolute necessity. It really amazed me what the excerpts were doing to my RSS feed, and as you said, it seems that many others were amazed by it as well!

    As always with WordPress, someone saved the day with a plugin. ;)

  6. kristarella (142 comments)19 August 07

    Ooops, I feel even more silly. I started using the more feature and didn’t realise that what you’ve just said in this post applied to it! I’ve installed Heft’s plugin!

  7. where can i find the Heft’s plugin … ?

  8. Kristarella – I made the same mistake! It’s a slight flaw in WordPress I think.

    Subcorpus – It’s the link at the bottom of the post. Here you go.

  9. Michael, do you use method 2?

  10. Yep, how’d you know? :)

  11. Andreea (2 comments)11 November 07

    How can I make a full text post in my blog, and return it only with the first 50 words in feed readers ? Please help

  12. Andreea – What you’re looking for is to use a post excerpt in your feeds. If you use Feedburner on your feed, you can use their “Summarize” option.

    Otherwise, you should check out the Dual Feeds plugin.

    Hope that helps. :)

  13. Andreea (2 comments)11 November 07

    It helps more than you think. Thank you very much!

  14. No problem. :)

  15. Ed (2 comments)7 January 08

    I have a good solution to this especially if you have too many posts to insert the “more tag” manually.

    Post Teaser – This is a great plugin.

    http://wordpress.org/extend/plugins/post-teaser/

    Ed

  16. Tristan (4 comments)21 May 08

    Hi Michael,

    I am trying to show the first three posts entirely, followed by the next 5 posts with only an excerpt.

    How do you think I can optimise Methode 2 to do that?

    Thankx in advance,

    Tristan

  17. Michael Martin (1511 comments)21 May 08

    Tristan,
    You would need to set up two separate “loops” on the page. One would show your 3 full posts, and the other would show the excerpts of the next 5.

    Have you used the query_posts template tag before?

  18. Tristan (4 comments)21 May 08

    Thank you for the quick answer.

    No I have never used the query_posts template tag.
    I just tried, and can’t manage to make it work…
    I get a blank page.

    Is there another way?
    I can’t use the normal loop, can I? ([code]< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>[/code])

    In fact, i’m not even sure that’s the best syntaxe for the loop. My theme must be starting to get obsolete…

  19. Michael Martin (1511 comments)21 May 08

    No problem.

    Yep, that’s the start of what you would use. In your index file, could you copy and paste everything from the line

    < ?php if (have_posts()) : ?>

    to

    < ?php else : ?>

    Not Found

    Sorry, but you are looking for something that isn’t here.

    < ?php include (TEMPLATEPATH . "/searchform.php"); ?>
    < ?php endif; ?>

    (Or email it to me!)

    I’ll send you back the code you need then. :)

  20. fatihturan (1 comments)19 July 08

    Hello.

    How i can do two different size with two different excerpt size in WordPress? In example: I want to do first featured post will be 380 character and other posts will be 270 character.

    By the way this is my work sample is here: http://www.xhmlmutfagi.com/sinemalardan/

    Thanks.

  21. David (23 comments)18 August 08

    I have a site that shows thumbnail of images of blogs and I want to show . Does anyone of you know how I could show excerpts of only certain post. So instead of showing excerpts from all post, I would only show excerpts from selected post.

  22. Michael Martin (1511 comments)18 August 08

    David,
    You would have to use the query_posts template tag to select only the posts you wanted, and then use a normal loop afterwards with the code for showing the excerpts as you want them.

  23. Lorna Kirby (1 comments)13 November 08

    d7nzb09ze7bvsdbl

  24. Muy bueno ….

  25. Hi, first of all I would like to show my appreciation for this useful plugin. However the text is right next to the images making it hard to read, wouldn’t it be good on the next update of this plugin to update to add a invisible border of 5 pixels or something? Anyway thanks again for the plugin exactly what I needed.

  26. Thankyou. This post helped me a lot

  27. Matt (16 comments)15 January 09

    Thanks! This helped alot!

  28. Thanks, great post. i have now managed to understand both ways of showing an excerpt. New to this wordpress but thanks to this page learning fast.

  29. This is a great blog, I stumbled upon it and read five posts before leaving. this post in particular helped a lot. I think I am going to start posting summaries. I have a friend who did there site in blogger though that would also like to post short introducrions to longer psts. Do you know how this is done?

  30. wave (2 comments)6 March 09

    Excellent post! Thanks so much. I found this on a search for how to do just this, and then had a real “duh” moment because I’ve been using wordpress off and on for a while now but never noticed the “more” tag option! (doh!)

    Looks like a great blog and I will be back to see what else I’m missing that’s right under my nose. Also appreciate the help on the php files and where to find the editing options – thanks!

  31. Very helpful article for my columnists who had questions. Saved me a lot of time, thank you!

  32. AJ Farro (1 comments)25 April 09

    Thanks for the excerpt tips. OMG, that stupid button on the WordPress tool bar has been starting me in the face for HOW long? Something so blatantly simple. I knew about it at one point and then I completely forgot about it. I feel like an idiot. Couldn’t see the forest for the trees. Now I’ve got to get busy and clean up my blogs. Thanks again.

  33. Dave (17 comments)27 April 09

    Thankyou for the info . We can add a code in the index file to show always an excerpt if you always forget to describe an excerpt with these methods :)

  34. Kathi (1 comments)4 May 09

    Hi. Thanks for this great tips. Now I know how to control text display for both my index and archive files. Thanks again.

  35. vicki (1 comments)12 May 09

    How do you actually select before you click the more button? Can’t get this to work. Is it the cursor, or do you highlight the text that you want to show before the more button?

    vicki’s Latest Post: A Conversation with…Carol Poore

    • wave (2 comments)12 May 09

      Hi Vicki – just use the cursor! Place the cursor after the text you want to show before, and then use the more button to insert the break at that point.

  36. Rob (37 comments)16 May 09

    Thanks so much for the insight. I have a small problem though, I have created a centercolumn.php to display the excerpt and when you click on the “READ MORE” it displays the post by itself, but it’s still just an excerpt.

    What am i doing wrong?

  37. Deran (1 comments)13 June 09

    Thanks a lot for this post. I used this on my blog. Keep up the good work.

  38. Micadz (1 comments)23 June 09

    I have followed your instructions under method 2, since I am trying to line up all the posts so that the Continue reading is on the same line for all the posts … but somehow it does not work … my website is http://www.commonpeople.sg/v1/

  39. Mobile (1 comments)30 June 09

    Hi!,

    I want to show complete post while opening RSS feed of my blog (http://www.cheapmonthlymobile.co.uk/blog/). How can i do that? I already enabled “Full Text” option in reading section, but doesn’t works? Help Me!!!

  40. TechThem (1 comments)8 July 09

    Thanks a million
    .-= TechThem´s last blog ..Andrea 0.3 Free WordPress Theme By lucianmarin.com =-.

  41. Jason (6 comments)18 July 09

    Great post, helped with what I was looking for.

    Cheers!
    .-= Jason´s last blog ..Edmonton Worldwide Photo Walk Update =-.

  42. I am using feedburner and I have burned the feed with http://www.snaphow.com/feed (I am also using Thumbnail for Excerpts Plugin)

    But What Happens is, that they Show the Fullpost in the newsletter….
    So I used the Summarize Option to shorten It … But it Removes the Thumbnails.

    What I want is to Show a Post Summary with Thumbnail and a Read more Link in the Email Newsletter of Feedburner.

    Is is Possible ?

  43. i’m wondering how to use the excerpt as a summary in the article page. somebody has an idea about this?
    (btw: @problogdesign: you have a perfectly clear blog-design!)

  44. German (2 comments)3 November 09

    Thank you very very veryy much!! for the answer. I was looking for the excerpt!.
    Muchas gracias amigos!!!

  45. Thank you so much for this helpful post.

  46. Oh fin, I got it …. thanks alot …….

  47. Thanks for the article.

    If you want to count your words, you can type “wc -w” (without quotes) in to a Linux command shell (which is what most web hosts offer).

    Then paste the first few paragraphs, hit Enter, then Ctrl+d.

    The wc command will report the number of words in your text.

  48. Mitko (26 comments)7 January 10

    Thank you very much! I have been trying to figure this out, but never could, maybe because I am new to WP.

    Anyways the more function should come with explanatory just like yours so newbies like me understand it better :)

  49. Mitko (26 comments)7 January 10

    May the author answer a question for me, Is it good that the Read More, sends you in the middle of the page where the articles continues?

    Or would it be better to show up the whole article from the beginning?

    Because the Read More , just does the first!

  50. Melissa (1 comments)13 January 10

    Thanks Michael, this provided a quick solution in simple English!!

  51. M Azr (1 comments)21 March 10

    very useful thanks very much

  52. You mention that excerpt returns the first 55 words but that can be changed by pasting an explicit excerpt. There’s another way since WordPress v2.7 to change the length for sites that don’t want to craft explicit excerpts and that’s to use a filter hook. Add this to their theme’s functions.php file to set the excerpt to 100 words:

    add_filter(’excerpt_length’,’set_my_excerpt_length’);
    function set_my_excerpt_length($length) {
    return 100;
    }

    HTH

    -Mike

  53. IronnSimba (1 comments)24 April 10

    Exactly what I was looking for, although I had to try it out first to find out that it applied to wp.com as well.

  54. Does any one know what the code is that splits the content up? For example, you add it to the Content box and everything above it is displayed on the homepage? I’m using a hosted blog on WordPress.org

  55. skat (1 comments)5 May 10

    hi!
    i have tried the more tag and amending the index.php for excerpts. well, i get the excerpts but when i click on ‘more’ or ‘read the rest of this entry…’ it takes me to a page that reads ‘error 404 – page not found’.
    can someone please help me solve this.

  56. Qasim dar (1 comments)7 May 10

    man i can not find this line

    in the home.php and index.php. im using a theme. but in the Category.php i found CLICK TO READ.
    should i try the first option and if so, do i have to edit all older posts?

  57. Grice (1 comments)25 May 10

    the_excert(); who would have thought. Thanks Michael!

  58. thermostat (1 comments)6 July 10

    Excellent and informative article, These days It’s so much easier to search for something rather than nutting it out your self.

  59. Helped me so much thank you!

  60. alvaro (1 comments)16 July 10

    Thanks, it was usefull to me :)

  61. Carlos (2 comments)20 July 10

    Thanks for the info! It was of great help! keep up the good work!!

  62. Dylan (3 comments)9 August 10

    haha wow thanks this is exactly what i was looking for.. !!!! every other site kept mentioning excerpt excerpt or whatever that is and i got really confused.. THANKS!!

Leave a Comment

Your reply will be added to the comment above (Below any other replies to this comment) -

(We DoFollow)

Not sure how to get an image with your comment?