wordpress-hacksI recently came to learn how useful using the excerpt feature that is built into WordPress. You can use excerpts if you want to show a short blurb for each post on your blog’s homepage, which I have been wanting to do on Tweeaks for a long time now I just didn’t know how to do it. Since I was doing some layout modifications, and I figured I should find out how to use excerpts, and I am happy I did since it’s so easy.

It can be good to use excerpts to increase page views, since visitors can see more posts at one time instead of having to scroll down through an entire post. Which is mostly the reason I wanted to make my homepage display excerpts, so I didn’t have to scroll all the way down just to see the second post. So, you will need to edit the file where you want to display them.

Showing excerpts on your homepage.

The template that displays on the home page in WordPress is the index.php file in your theme directory. Open that up and find the following code:

1
<?php the_content(); ?>

The code may vary depending on your theme. It may also look like:

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

All you do is simply replace  “the_content” with “the_excerpt” like this.

1
<?php the_excerpt(); ?>

This will make your homepage display only the first 55 words of the post, and strip any images or formatting.

You can override the limit of 55 words if you want two different ways.

  1. The More Tag: After you’ve written a post, go to the code view in the post editor and click where you want the excerpt to stop, and then click the More button.
    more
  2. The Excerpt Field: Copy and paste part of your post into this field located below the post editor. This is good if you want to display links or images in your excerpt and it is what I personally would recommend using.
    excerpts

Using excerpts can also be useful on your archive pages, category pages and author pages as well.

Custom Fields

Another feature that is extremely useful, and easy to use is custom fields.

custom-field
I won’t go into using this feature right now, because it deserves a separate post. You can do things like set an expiration date for posts, choose to display either an excerpt or full post on your homepage, display thumbnails next to your posts, and many other things.

Here is a great article 10 Custom Fields Hacks For WordPress. You will see that custom fields can do some some really cool things.

Do you use excerpts on your blog?

Get automatic updates! Subscribe to Our RSS Feed or Get Email Updates sent straight to your inbox!