Make Full Use of WordPress with the_excerpt_reloaded!

Whether you know it or not, you'll probably use the_excerpt on your website. At its simplest, the_excerpt will display the last 70 odd words from your posts on the homepage, or a couple of words explaining what the post is about, as it is on CatsWhoCode. But say you wanted to display 200 words and images. Without editing the core Wordpress files, there is no way you can do that, without installing a plugin, like the_excerpt_reloaded.


You can download it here (clicky). Install it and activate it in the normal way. If you don’t know how to do that, head over to the WordPress codex (clicky).


Next thing we’ll need to do is edit your theme’s files in order to integrate the_excerpt_reloaded. On your WordPress admin panel, click design, then theme editor. Then under “templates” click “Main Index Template” (or whatever the homepage for your theme is). You’ll then be presented with a whole load of code. Before you edit anything, you should always back up what anything you’re changing, so copy and paste your code into Notepad, or if you’re running Ubuntu, text editor will do the same job.

Once you’ve done that, you need to hunt down the_excerpt. If you can’t see it, use your browser’s search function to find it (ctrl + f). Once you’ve found it then we can start editing! the_excerpt_reloaded lets you do some quite advanced stuff, so I’ll briefly run through what you can do:

  • The default setting, with the code just being <php the_excerpt_reloaded(); ?>, on your page displayed will be 120 words of either your excerpt field or the first 120 words of the post. You can set the number of words to whatever you like, but here we can set it to 50 by putting 50 in the brackets:<php the_excerpt_reloaded(50); ?>
  • We can add more functions by putting a comma after the 50, so say you wanted to allow images to be shown, you’d put:
    <php the_excerpt_reloaded(50,'<img>'); ?>
  • Read On! You don’t have to have “more…” at the end of your excerpt – by adding in “TRUE, ‘Read on’” at the end of your excerpt, you can say “Read on”. So our excerpt now looks like this:
    <?php the_excerpt_reloaded(50, '<img>', TRUE, 'Read on'); ?>
  • Excerpt x2! On my site www.nometet.com, I’ve got two excerpts: a quote from an article and the first 200 words from the post. How do you do that? add in 2 to your excerpt, so our excerpt now looks like this: <?php the_excerpt_reloaded(50, '<img>', TRUE, 'Read on', 2); ?> The 2 is telling WordPress to fake the excerpt as real content, so always displaying the first 50 words even if you’ve written something in the excerpt box.

So thats the basics covered. You can do even more with the_exerpt_reloaded! Check out the plugin homepage here for more info.

Oh, and its my first post here! I’m Alex Denning, WordPress power user, web design freelancer and editor of Nometet.com and GGG! I’d appreciate any feedback; have I pitched this too simply, or have I assumed you know too much? If you want to speak privately or are interested in having some web design work done, drop me an email: alex (at) nometet (dot) com.