Using WordPress Excerpts – “Read More”
I got asked this question today;
I’d like my postings to be condensed with some type of “Read More” link at the bottom to expand them for reading
Having an additional link to “read more” in your WordPress posting is a great idea for a couple of reasons.
The first reason is a matter of preference. By default, WordPress will use the built in function of “the_content”, which is located in at least one file in your default theme directory, the homepage file which is the “index.php” file. What this means is that WordPress will show full posts, with the title being a link to the full post in the “single.php” where a user can comment on your post and see other additional information. If you don’t make any to the default theme, WordPress will show something like 10 posts on your homepage, and depending on your ability to write concisely:) you can have a long scrolling page. This is a preference, some people don’t mind this, others really don’t like it at all.
The second reason, and the more important reason for having “excerpts” is for search engine reasons. Google doesn’t like duplicate content, within a site, or one website that has plagerized another. You have the possibility of being black listed for blantant obvious violations. So, using the power of having an “excerpt” allows you to either write a custom hook for your homepage to lure in readers to the article, or you can just insert a tag to use a portion of the already written post as the hook.
How to change your theme to use excerpts
Again, in the post gui, you have a “more” button that you can insert some text called “” and this will automatically cut off your post and make an excerpt for you. But, if you would like to option to not have to remember to add that snippet of code every time you post, and have the excerpts happen automatically, you set that up by modifying your theme. Open up your index.php file in your default theme folder and look at approximately line 14 where you will see this code inside the php tags;
php the_content(‘Read the rest of this entry »’);
Change that line to read this instead;
php the_excerpt();
More information about this template tag / function / class or whatever you want to call it:) is located in the WordPress codex on the_excerpt (which is a programmers term for code manual).
How I use excerpts on my blog
I wasn’t satisfied with the fuction that the WordPress developers provide. The problem I had with the_excerpt, is that it strips html. So your posts will look like a non-formatted, run on mess. I felt like strongly about being as customizable as possible, and frankly, more professional as a designer. I don’t know much about php, so I wouldn’t be able to hack the core code. Besides, I wouldn’t want to, because my changes would have to ported over each time I upgraded my version of WordPress.
So, I found a great little plugin for WordPress that allows me to format my excerpts all I like. It’s called The Excerpt Reloaded, and it let’s you set a ton of options like excerpt length, the name of your “read more” link, the allowed html in the excerpt and more.
Here is a screenshot from Rotheblog showing how I have been able to use both div’s and images and other formatting in my excerpts to make the hook for the post really appealing;

Make sure to use version R1.4, and not R1.1. Version R1.1 had issues where it wouldn’t close the allowed tags which would then close a tag in the layout of the site and break the visual look. Fortunately another developer took over and made those changes, but you will want to look at the original Excerpt Reloaded page to see all the template tag parameters for setting up your excerpt.
Questions? Comments?
Leave a comment. Has anyone modified the code base for WordPress to leverage the_excerpt template tag to do the same thing as the plugin? I’d love to hear about it if you have.