Display Excerpts in Twenty Ten

Please use this post http://twentyten.info/twenty-ten-tips-tricks/display-excerpts-in-twenty-ten/ for comments as content is now being updated there.

I didn’t think this would be as easy as it was until I did a bit of searching. I’ve been messing with Twenty Ten theme and getting it to display two columns of posts on the main page.
The issue with this is, each post is a different length, so it makes the page look uneven. To fix this I wanted to show only the post excerpt, that way each post would be the same size until it was selected.
Twenty Ten by default does not display the post excerpt.

To make Twenty Ten show the post excerpt follow these instructions.

1. Make a copy of Twenty Tens loop.php
2. Open it and find the line around 132 that reads

<?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?> 

3. Change that line to

<?php if ( is_archive() || is_search() || is_home()) : // Display excerpts for archives and search. ?> 

4. Upload your loop.php to your child theme directory and view your homepage.
5. To control how much text you want in the excerpt open functions.php and fine

function twentyten_excerpt_length( $length ) {
	return 40;
}

and change the number 40 to a higher number to display more text or lower to display less.

I’ve also posted a bunch of small snippets that I find useful, most are for Twenty Ten theme, but work on other themes as well. You can view it under projects or click here




9 thoughts on “Display Excerpts in Twenty Ten

  1. Around the time you posted this I was thinking about how I could go about accomplishing doing exactly this but in the few minutes I took to look couldn’t figure it out and thought about searching online to see if anyone else did it. Thanks.

    One comment on this, I didn’t make a child theme so I edited the loop.php directly…there were also two places in that file that have the line:

    so I just modified both of them.

  2. Whoops, the missing line should be

    >?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?<

  3. You’re right Craig, that code does appear twice, once for asides and once for everythign else. I don’t think it’s needed for the asides area, but it won’t hurt. The second occurrence line 132 is the line I was referring to.
    Thanks for pointing that out.

    • It probably works the same way, I didn't look into doing it this way too much, I was researching how to go about making a grid style layout for a theme and came across this bit of code.

      Thats a cool plugin too, I might try it out on another site I have, thanks