• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Nile Flores Media

Helping You Rock Out Your Website Like A Rockstar

  • Home
  • About
  • Blog
  • Portfolio
  • Hire Me
  • Resources
  • Contact
  • Blogging
  • WordPress
  • Social Media
  • SEO
  • Web Design
  • News
  • Podcast
You are here: Home » WordPress » Display First WordPress Full Entry and then Following as Excerpts

Display First WordPress Full Entry and then Following as Excerpts

By Nile Flores 56 Comments


I like to use this code to display the first full entry and then the rest of my entries as excerpts from my main page. This is not hard to do and only requires that you replace a few code snippets. You can apply this to your theme’s index template file (most commonly index.php), or whatever your blog template file may be called.

Look for the following code in the loop in your:

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

Replace with the following.

<?php if (have_posts()) : ?>
<?php $postcount = 0; // Initialize the post counter ?>
<?php while (have_posts()) : the_post(); //start the loop ?>
<?php $postcount++; //add 1 to the post counter ?>

This code allows your blog to see how many posts you have.

2. Look for the following code. You are going to be replacing the_content

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

with:

<?php if ($postcount == 1) : // if this is the first post ?>
<?php the_content('Read the rest of this article ->'); //Show the full post ?>
<?php else : //if this is NOT the first post ?>
<?php the_excerpt(); ?>
<?php endif; //end of the check for first post - other posts?>

The code basically tells your blog to show the first as the full entry and the following posts as excerpts.


Filed Under: WordPress Tagged With: the_content, wordpress, wordpress display posts, wordpress excerpt, wordpress tricks

About Nile Flores

Nile is a 43-year old female from the greater St. Louis (Southern Illinois side) area. Nile is a mother of 1 son. She is also a web designer and developer, a graphic designer, and a public speaker, who exclusively designs and develops using WordPress. She also blogs at GoDaddy's Blog, Verpex Hosting's blog and her very personal sites, Pixelled and Nail Polish Happy.




Related posts:

Edit The Number Of Words For The Excerpt in WordPress How to Change The WordPress Default Avatar Applying Author Gravatar In Post Comments Brand Your WordPress Login Page Without A Plugin How to Display A User Welcome Message In WordPress

Reader Interactions

Comments

  1. Anonymous says

    December 30, 2011 at 8:40 pm

    wow this article is very nice. It’s a new inspiration for me. i like it. thank you my friend. merry christmas and happy new year.

    Reply
  2. Jon Anscher says

    December 31, 2011 at 1:50 pm

    Nice! Clever idea. I’m going to have to mess around with my website to see if I can get that worked out :-).

    Reply
  3. john says

    January 1, 2012 at 5:12 am

    What code would you use to have a footer link on all of your pages and not just your home page? Ive been messing with it for awhile and cannot figure it out. Any help would be appreciated.

    Reply
  4. benji grenier says

    January 1, 2012 at 7:48 pm

    Great post. I will look forward to more 🙂

    Reply
  5. Khriscia says

    January 2, 2012 at 1:48 am

    Hi…I am really happy because I have found the post you have for us..Now I am more familiar with this post…Thanks a lot!!

    Reply
  6. Fred says

    January 2, 2012 at 6:05 am

    I practising web designing before and this time I will look forward for this code. Its been a long period of time that I use Notepad++ for my website.

    Reply
  7. matt says

    January 2, 2012 at 10:31 am

    Nile, that is something I want to do with my site since I am encountering page load time problem but I am afraid to do it on my blog coz I’m not really techie. I would suggest you create a plugin for that for sure a lot of webmaster would really be interested in customizing their homepage.

    Reply
  8. Shameka Hennagir says

    January 2, 2012 at 9:18 pm

    That is exactly what I’m trying to do yesterday and I can’t go through because I can’t get the exact code of PHP. Thanks for this code I better yet try this one.

    Reply
  9. vishvast says

    January 3, 2012 at 2:27 am

    hello
    thnx for this post very inpirational for me i m going to share it with my frnds also nice featured article

    Reply
  10. Monica says

    January 3, 2012 at 2:34 am

    Thanks for explaining the code step by step .. your blog is great help and keep us posted. Happy blogging thanks again !

    Reply
  11. Elvis Shrestha says

    January 3, 2012 at 3:16 am

    Hey there this is a wonderful post and your blog has got a good collection of resourceful articles… Nice blog design, your blog looks blondish… 🙂

    Reply
  12. Darryl burgess says

    January 3, 2012 at 5:41 pm

    Nile your knowledge with word press is great. Being a novice of sort I appreciate all of your insight. Thanks for the great post once again. I look forward to future posts.

    Reply
  13. Jamie Hollister says

    January 3, 2012 at 6:49 pm

    Knowing how to edit a little code with wordpress is extremely helpful, thanks for the great tip.

    Reply
  14. krishna says

    January 4, 2012 at 12:51 am

    Nice post wish u a very happy new year

    Reply
  15. Fred Martin says

    January 4, 2012 at 3:43 am

    very good stuff. Its also very beneficial for me as well as for visitors also. I want to do the same for my bloggspot. is there any replacing code to do that? I was trying but not succeed.

    Reply
  16. Peter says

    January 4, 2012 at 4:19 am

    Thanks for sharing this really great tutorial. I really like wordpress and always want tot improve more and know more about it. Thanks!

    Reply
  17. David says

    January 4, 2012 at 7:09 am

    I honestly not good in WordPress, i will try this to my site to make a little change.
    thanks for the tips!

    Reply
  18. aufa says

    January 4, 2012 at 8:28 am

    I don’t dare change my WordPress code. I’ve tried, and everything is so messy. Now I use a theme that has been customized. But this article is good enough to learn. Thank you 🙂

    Reply
  19. Steve Borgman says

    January 4, 2012 at 9:24 am

    Nile, thank you for this handy tip! I’m going to bookmark this article and put it in my To Do list to improve my sites. Thanks for all you do!

    Reply
  20. Jacko says

    January 4, 2012 at 11:09 pm

    Thanks for the tip.

    I recommend you use a subscription service to build your email list and send out notices no more than once a week.

    Reply
  21. Cynthia says

    January 5, 2012 at 8:30 pm

    Ahhh, what a relief to see someone who likes technical, “geeky” (no offense intended) stuff just like I do. 🙂 Thanks, I will be looking for more tips in your site.

    Reply
  22. Nathalie Villeneuve says

    January 6, 2012 at 8:27 am

    Nile, thank you for this great tip! You have the best stuff to help us make improvements and gain more knowledge about blogging and being more efficient

    Reply
  23. Perry A Davis Jr says

    January 6, 2012 at 11:20 am

    Hello Niles

    It seems that excerpts, especially in search results, helps the reader get to the information they need faster, making them happier readers. Currently I display one full article and two excerpts on my blog. What do you think about only displaying excerpts?

    Thanks

    Perry A Davis Jr
    Music City

    Reply
  24. Manuel Marino says

    January 6, 2012 at 8:02 pm

    very good ideas, absolutely.

    I solve in another way, creating sticky posts (static pages) to attract visitors attention to the best articles I’ve got.

    And I change them from time to time.

    Reply
  25. Anonymous says

    January 7, 2012 at 7:36 am

    Great I will try this on my wordpress blog, but can you do this for blogger as well?

    Reply
  26. Donna Merrill says

    January 7, 2012 at 11:25 pm

    Just wanted to say that you are doing such a great job on your blog. This post in particular is a challenge for me – but reading it twice did finally get into my head. I have a word press blog and need to start doing things myself. It is a Giant learning curve for me because I’m all tumbs when it comes to this. But please keep your information coming. I’m enjoying your posts.
    Donna

    Reply
  27. Yorinda says

    January 8, 2012 at 4:42 pm

    Thank you, Nile, for the informative article.

    Coding fascinates me, so much we can do with it!

    The Suffusion Theme for WordPress has lots of options to set excerpts for you posts,categories and even tags.

    Great to have information from an experienced Webmaster!

    Reply
  28. kristeen says

    January 9, 2012 at 3:27 am

    SuperB article. Love the way you set-up the article. Its really good writen, thanks!

    Reply
  29. Eddie Gear says

    January 9, 2012 at 6:13 am

    while I appreciate you dealing out the process and helpful tutorial, Here is one advice on SEO, do no display full post in multiple locations, as they are considered as duplicate content. Imagine a crawler fetching the homepage with the full content post and also the single page url. Now its seen two different urls with the same content.

    Reply
  30. Monica says

    January 9, 2012 at 7:51 am

    Thanks for the explanations. You have a unique way of explaining the code

    Reply
  31. Chris says

    January 9, 2012 at 12:47 pm

    Code fascinates me. I’m just glad there are some smart folks out there that can figure this type of thing out for the rest of us. Thanks for sharing!!

    Reply
  32. Edyta says

    January 9, 2012 at 1:21 pm

    Hi Nile,

    Thanks for sharing very interesting tips. I didn’t realise that it is so easy. I would like to know how to create slide show that you have on your home page. Please give me some tips. Thanks.

    Reply
  33. alicia says

    January 9, 2012 at 5:22 pm

    I enjoy navigating in your website, it is easy to find my topics of interest. Thanks so much for the tip; I will work on it to apply it on my blog.

    Reply
  34. Doug Gene says

    January 9, 2012 at 10:48 pm

    Thanks for the helpful codes, Nile. Know of any other code resources for WordPress?

    Reply
  35. rohit kothari says

    January 10, 2012 at 7:24 am

    just one word for this thanks i was looking for the solution(coding) of making full entry and found this on your site so good luck create such wonderful post in future too

    Reply
  36. Stevie says

    January 10, 2012 at 5:07 pm

    That’s really a cool trick. That’s the beauty of open source though isn’t it. The ability to fine tune to one’s heart content!

    Reply
  37. Kevin Martineau says

    January 10, 2012 at 10:02 pm

    Thanks for sharing how to do this Nile! This is awesome. I am going to give it a try.

    Kevin

    Reply
  38. Paul Reimers says

    January 10, 2012 at 10:03 pm

    Cool trick,

    I always like to see a number of posts in excerpt form to make it easy to choose from, but this approach is excellent in that it naturally gives more weight to the most recent post.

    Reply
  39. Vernon says

    January 11, 2012 at 7:14 am

    Thanks for sharing the codes and explaining how to use it directly. I will try it right away. More thanks.

    Reply
  40. clare says

    January 11, 2012 at 9:43 am

    Hi Nile,
    Thanks for this great tip! Just what I wanted to learn about. I have become more confident in applying code to my blog. I don’t like seeing the full articles displayed. I am bookmarking your site so i can come back to this when I get to this point on my week’s to-do list! Also, I assume that adding code is more efficient that using plug-ins which slow the site loading time?

    Best regards,
    Clare

    Reply
  41. Coach James says

    January 11, 2012 at 10:06 am

    Interesting idea. I haven’t ever wanted to have a full post on my blog page, but I wonder if this helps keep people focused and on your site longer as it present the post and the reader doesn’t have to click….

    Hmmm. Will give some thought to this.

    Thanks,
    James

    Reply
  42. sadie-Michaela Harris says

    January 11, 2012 at 4:42 pm

    Hello Nile Happy New Year, I have a growing list of tasks to make my site function better and thanks for all your tips, I appreciate you 🙂

    Reply
  43. Sharilyn says

    January 11, 2012 at 8:12 pm

    Now I get a lot of ideas from this post…I am really thankful or this!!Thanks a lot then!!

    Reply
  44. cat says

    January 13, 2012 at 12:44 pm

    Hi, I’m using the Pagelines theme and that code I could not locate in the index template to make changes. Any ideas? I’d like to make my posts actually all longer (all of them on home page) not just the first one – they said I’d need to change the WordPress coding – but next best thing would be for the first one to be longer.

    Thank you!

    Reply
  45. Jeffrey T. Sooey says

    January 15, 2012 at 10:50 pm

    Thanks Nile. Thanks for the tip. These codes will help me in my blog entries. Can’t wait to try it out on my next blog.

    Reply
  46. Jeziel says

    January 16, 2012 at 6:57 am

    This is a big help to me and for all the people who will read this then…Thanks for the great post and this is a big help too…

    Reply
  47. masita says

    February 15, 2012 at 11:48 am

    Thank you for your tips. I use a theme that is easy to use. I’m afraid to change the existing standard script, because I have a bad experience about it. but finally I find out a little way about how to edit the blog script from this blog 🙂

    Reply
  48. Peter says

    March 2, 2012 at 10:35 am

    Thanks for sharing very interesting tips. I didn’t realise that it is so easy. I would like to know how to create slide show that you have on your home page. Please give me some tips. Thanks.

    Reply
    • Nile says

      March 9, 2012 at 3:08 am

      I am actually using a WordPress plugin for my slider. It is a premium one, but the free version is in the WordPress directory and called Easing Slider.

      Reply
  49. jobin says

    March 16, 2012 at 6:06 am

    your blog is great help and keep us posted. I have become more confident in applying code to my blog…..

    http://www.findghar.com

    Reply
  50. Navin kunwar says

    March 17, 2012 at 9:55 pm

    i use plugin to display the excerpts but using the code in theme is great way to reduce server load. thanks

    Reply
  51. sai krishna says

    April 21, 2012 at 12:06 am

    i’m looking for this tutorial from so many of days , finally i found it . Thank you for the tutorial , nice share 🙂

    Reply
  52. matt says

    September 11, 2012 at 8:48 am

    Hi Nile, its me again. I just want to ask if how can I just display excerpts on home page instead of full entry of first post.

    Reply
    • Nile says

      September 14, 2012 at 12:02 pm

      In your template, instead of the_content call, you want to put the_excerpt.

      Reply
      • matt says

        September 20, 2012 at 4:16 am

        Hi Nile, yes, is it possible? I’ve change the_content to the_excerpt on page template but nothing happens. May I know what particular template to edit. I am using wordpress theme coraline. Thanks.

        Reply
  53. Mohana says

    September 20, 2022 at 2:58 am

    WOW! What a simple, highly useful tutorial! Thanks for this great help!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow Me On:

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube

Get The Latest WordPress & Blogging Tips

Sign up for my newsletter, and also get my free ebook on 10 Reasons Why Your Website Isn't Converting, and How to Fix it!




Try to be More Positive on Social Media

Note: You can click on image and view the video in a larger lightbox window.

Footer

The Blog

Lots of free information, tutorials, and more to help you bring your best foot forward with your website.

  • Blogging
  • WordPress
  • Social Media
  • SEO
  • Web Design

Get The Latest WordPress & Blogging Tips

Sign up for my newsletter, and also get my free ebook on 10 Reasons Why Your Website Isn't Converting, and How to Fix it!

Copyright © 2025 · · WordPress