Forums

Formatting index page excerpts in Twentyten theme (3 posts)

  1. billbennett
    Member
    Posted 1 year ago #

    I've tweaked the front page of my TwentyTen child theme to show excerpts instead of full posts by changing:

    <?php the_content ..... ?>

    to

    <?php the_excerpt ..... ?>

    in the loop. It works just as expected.

    However, the CSS div for each excerpt is in the form:

    <div id="post-151" class="post-151 post type-post status-publish format-standard hentry category-features">

    Which is identical to the code for each full story on a post page.

    I'd like to format my excerpts differently to the posts.

    If I get into the loop and alter the PHP code:

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    to:

    <div id="excerpt" <?php post_class(); ?>>

    I lose the thumbnails shown with the excerpt. I don't understand why this should change because there is no CSS for #post or #excerpt

    How can I

    1. Keep the thumbnail in the excerpt, and
    2. Give the excerpt its own format separate from the post?

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    one possibility, adding the css class .excerpt to the post classes:

    <div id="post-<?php the_ID(); ?>" <?php post_class('excerpt'); ?>>
  3. billbennett
    Member
    Posted 1 year ago #

    Thanks alchymyth. In the end I cheated by creating another div in the loop that only shows on the index page. Seems to work nicely.

Topic Closed

This topic has been closed to new replies.

About this Topic