with Lorelle and Brent VanFossen

Solving the WordPress Excerpt Problem – Sorta

The WordPress Blog Excerpt Problem (as I call it) came from the desire to have the first page of my blog, index.php, show only excerpts of the blogs instead of the default, the entire blog. I could easily change the number of blogs shown on the entry page through Options, but I couldn’t figure out how to show the excerpts.

There is a plug-in to make excerpts show automatically, but I can’t get that to work either, even after asking in the WordPress Forums, which are usually terrific. Guess my question was too simple.

Anyway, I haven’t solved the Excerpts plug-in problem, but I now have a better understanding of the problem and how to make this work without the plug-in. It’s so simple, it really gets me that it wasn’t explained in a simple fashion.

In the WordPress editing window on the quicklinks bar there is a tag for “more“. In the place you want a link for “more” to be seen on the main index.php page, click on the “more” tag. It puts a jump link in the blog which appears on the main page making the blog entry appear to be an excerpt.

So your line in your entry would look like this:

This is the last line of a blog entry with a paragraph underneath and I'm writing it today. <!--more-->

This is the second paragraph I'm writing underneath that isn't seen on the first index.php page but will be seen with the entire blog entry when you click the "more" jump hyperlink.

This creates a link that jumps to your full blog entry and then down to the targeted link point so the reader can keep reading at the spot. In the full blog entry, the jump link is gone as that is the target point. Very slick.

Where you set the “more” tag, it shows up. If you set it at the end of the line, it will show up at the end of the line. If you set it between two lines, in the blank “line” between paragraphs, it will show up under your last text line on a new line on the index.php page, but on your main blog entry, it will not show the “blank” line between paragraphs (if this is your style) but no line between those two paragraphs. The link shows up where you put it and you have to take that into consideration on where you put the “more” link tag.

I’ve edited back an entire month to put the “more” tag in my blog entries and now the first page looks great with “excerpts” instead of the whole entry. I’m thrilled.

Lorelle
Tulsa, Oklahoma

> > > Later: There is a new section in the WordPress Documentation site called the Codex that goes into great detail about how to use this more quicktag button and how to customize it. You can find it at Customizing the Read More for Excerpts for WordPress.

Even Later: The answer was much easier than I thought. In the index.php template file, or any WordPress template file that displays more than one post at a time, like the archives, search, category, etc., simply find the_content() template tag and change it to the_excerpt(). Instant excerpts. Wow! Too simple.

6 Comments

  • Adam
    Posted April 24, 2005 at 2:34 | Permalink

    I was trying to solve this problem the whole day, I have searched the forum, all faqs but failed to find an answer. Luckily I found your site, and the solution is stupidly simple. I don’t know why they put the button “more” with all the other buttons there, it should have been highlighted somehow that this is an excerpt button or something. Anyway Lorelle thanks a lot for your solution.

  • Posted April 24, 2005 at 10:57 | Permalink

    Glad to help. This caused me no end of nightmares trying to figure it out. Be sure and check the new WordPress Lessons section for some great tips and how tos on using WordPress. That’s where I finally found my fix.

  • Posted May 21, 2005 at 9:18 | Permalink

    I solved it showing only the excerpts on main page but the whole post when read alone. It’s easy :)

    In your template, where the_content is used, replace it by:

    <?php if (is_home()) {
    the_excerpt();
    } else {
    the_content(__(‘(more…)’));
    }
    ?>

    So, use the is_home() function to decide if to show only the excertp or the full post.

  • Posted May 22, 2005 at 15:59 | Permalink

    Let me think for a minute. Garbly gook PHP or clicking a “more” button? Hmmm, which is easier? ;-)

    A lot of people have trouble with this, and once they discover the “more” button, life is easier. Trying to actually change the PHP WordPress Loop, that’s straining the brain cells for a lot of folks.

    In the end, in an article I haven’t posted yet, I used your solution, but even more complex. But the “more” quicktag is still a sweet and easy method.

    Thanks!

  • Posted December 18, 2005 at 2:56 | Permalink

    Ahhhh finally I found it!
    thanks :)

    But still, when I go in category listtings, I see the whole posts :(
    Since I make long posts with lots of downloads and flash examples, is messy for me…
    anybody a solution for category index pages?

    thx
    http://www.pippoflash.com

  • Posted August 8, 2006 at 10:01 | Permalink

    This info was really usefull. I though the optional excerpt was used as a preview feature. That’s how they do it in Post-Nuke and Php-Nuke. Thanks for posting this.

2 Trackbacks

Post a Comment

Your email is kept private. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>