Twenty Ten WP Theme: Excerpts Only On Main Page

I found out that the default WP 3+ theme now is no longer Kubrick but Twenty Ten. Well, I should say that my first impression of it is good and (though it’s not the best basic wp theme) I feel like it’s a breath of fresh air after so many years of the blue Kubrick.

Usually, as soon as I’m done setting up and uploading a wordpress site, the first thing I do is change its theme because Kubrick just feels so ‘just set up’, ‘just now’. Twenty Ten however does not give me that feeling. Although it’s still simplistic and basic, it makes want to dive into its hood because it’s the kind of theme (with a premium wp theme feel) that invites and tells me to ‘tweak me’. Thus, when I first bumped into it just a few weeks ago in a new site I put up, I decided to leave it be and check out what it does before I decide whether to change themes or not.

I Want Post Excerpts Only In Main Page

Although a lot of people are heaping praises on Twenty Ten seo-wise, I think it still can use a lot of improvement. I don’t know with others, but I’m used to having my main page display excerpts only instead of the whole posts. Twenty Ten displays the whole posts’ contents (the latest posts) in the main page. Wouldn’t this contribute to duplicate content? I was beginning to wonder if this is the reason why the inner pages aren’t being indexed by Google despite my pinging and digg-ing, etc. Only the home page has been indexed even now. (This arrangement, full post content on main page, however are present in some great blogs e.g. wassupblog,etc. Does that mean google does not see duplication of content here?)

I searched in the wp admin dashboard and settings for a toggle to set it to display excerpts only. Perhaps there’s one in there for that purpose, but nope, I have not stumbled upon it yet. So, I have no choice but to try to tweak it myself. I’m not an expert in PHP so I just crossed my fingers after doing some edits inside the loop.php file. Somewhere in the loop.php file, I changed a line and that portion of code looks like this now;
[tip]


<?php if ( is_archive() || is_search() ) :
     // Only display excerpts for archives and search. ?>
        <div class="entry-summary">
	    <?php the_excerpt(); ?>
	</div><!-- .entry-summary -->
<?php else : ?>
	<div class="entry-content"> 
	    <?php the_excerpt(); ?>   
	    <?php wp_link_pages( array
	    ( 'before' => '<div class="page-link">'
	    . __( 'Pages:', 'twentyten' ), 'after' => '
	    </div>' ) ); ?>		
	</div><!-- .entry-content -->
<?php endif; ?>

[/tip]

That red line of code up there replaced the original code line:


<?php the_content( __( 'Continue reading &rarr;', 'twentyten' ) ); ?>

Voila! The main page now displays only the excerpts of the posts! I hope some PHP expert would stumble on this post so he could evaluate if this is correct and, if there is any possible danger, warn me of any catastrophe my meddling with the code could cause. For now, I’m cool with what I had effected on the new site. If you haven’t seen twenty ten, you can check it out here.

BTW, I also found the header section of Twenty Ten too big (it takes the space of almost half the visible page), so I also tweaked this section to shorten the height to comfortable levels.

8 comments

  1. The code in this article is dated. here is a working code for 2010 theme that comes with wordpress 3.0.1

    i tried pasting code directly here but the comment system wont allow me.

Comments are closed.