4. WordPress More Links and Excerpts

There are two ways posts can be shown, the full posts, or an excerpt. In WordPress Hack #1: query_posts I showed you what to add to “the loop” to make posts excerpts. For your homepage, there is an easier way to do this with the Homepage Excerpts Plugin.

homepage excerpts plugin example options wordpress

This plugin (as you can see in the options above) gives the flexibility to say how many posts will be full and how many excerpted, and how many words to show. You can also choose to use “custom excerpts”, which is a field you can fill out when writing a post. It’s very important you understand how this works. When you create a post there is a field you can write you own “excerpt” into. You probably never noticed it, it’s below where you write your posts, and it looks like this:

excerpt example

If you write a “custom excerpt” in this field, and then use the homepage excerpts plugin and change “use custom excerpts” to “yes” – then the custom excerpt will show instead of the first 50 words from the post. This means that you can have original content on your homepage that’s not on single post pages. You could also use these custom excerpts for other things, like a featured block on your homepage. It’s a lot more work to write one for every post you have, but could be well worth it depending on how you’re using your blog.

Now that you know how to change your homepage to excerpts using a plugin, let’s find out how one hacks code in a theme to do this at will! Once again, you can find this information on the WordPress Codex page “Customizing the Read More”. On any wordpress theme template page that displays posts in a “10 per page” fashion, like your homepage (index.php), a category or tag page (category.php or tag.php if you have one), or an archive page (archive.php) – each of these pages has a loop containing the call “the_content”. Anytime you see “the_content” in the loop – it’s a PHP call to get “full posts”. In other words, code that looks like this gets full posts:


If you want to change that page to show excerpts instead of full posts, just change “the_content” to “the_excerpt” like this:


To learn how to customize the actual “read more” text in the link to the full post, The Read More Codex Page has all the details and sample code you need.