Support » Fixing WordPress » First post different to second

  • I am looking for the first (most recent) post on my home page to appear different to the rest below it. I’d like for it to be a regular post with, say, a large centered image, and the rest to be an excerpt of the article with a smaller image.

    I understand to do this I need to post an excerpt with my posts but is there a way for the first post to ignore the excerpt?

    Hopefully this makes sense and thanks for anyone who can help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael


    Forum Moderator

    to do this I need to post an excerpt with my posts

    nope – you can do that, but the WordPress function the_excerpt() would otherwise automatically just show a few words of the post;

    general structure in the loop i.e. after <?php while(have_posts()) : the_post(); ?>

    if($wp_query->current_post == 0 ) { ?>
    the way to show the first full post with image etc
    <?php } else { ?>
    the way to show the all other post with excerpt etc
    <?php }

    Just to clarify. I currently have the follow to instruct my index page to display posts:

    <?php the_excerpt(); ?> <a>"> Read moreĀ»</a>

    Where would I put the code you mention in order for the first post to appear as a non-excerpt and the rest as the excerpt as instructed above?

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code has been permanently damaged/corrupted by the forum’s parser.]



    Forum Moderator

    there is likely to be more code in index.php – for instance there is usually a loop: see

    feel free to post the code of index.php here – please use the pastebin as described in

    Yes there is more, just didn’t want to past the whole thing, but here it is:

    [no bumping, please]



    Forum Moderator

    for example:

    based on your exising code – you still need to clear up any unwanted output, and add the images – possibly using the_post_thumbnail()

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘First post different to second’ is closed to new replies.