Title: First post summary for Index.php
Last modified: August 18, 2016

---

# First post summary for Index.php

 *  jimmyneutron
 * [21 years, 6 months ago](https://wordpress.org/support/topic/first-post-summary-for-indexphp/)
 * This code hack might be useful to someone. On my web site home page I wanted 
   to show the latest post as a summary and then show the previous 6 posts as simple
   links.
    You can see how this code works here: [http://www.startrekuk.com/.](http://www.startrekuk.com/.)
   This is simply a few if statements wrapped around `the content()`. ` <?php  $
   first = True; if ($posts) : foreach ($posts as $post) : start_wp(); ?> <?php 
   the_date('','<h2>','</h2>'); ?> <h3>[" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>](https://wordpress.org/support/topic/first-post-summary-for-indexphp/"<?php)
   </h3> <?php if ($first){ ?> <?php the_content(); ?> <?php } ?> <?php $first =
   False; ?> <?php endforeach; else: ?> <?php _e('Sorry, no posts matched your criteria.');?
   > <?php endif; ?>

Viewing 1 replies (of 1 total)

 *  [thr](https://wordpress.org/support/users/thr/)
 * (@thr)
 * [21 years, 6 months ago](https://wordpress.org/support/topic/first-post-summary-for-indexphp/#post-103774)
 * Great stuff. I’ve modified the hack a little bit.
    Now you can choose how many
   post should be displayed as summary, simply change the $fullposts variable: `
   <?php $first = 1; //number of latest posts which are showed as summary //the 
   previous posts will be showed as simple links $fullposts = 5; if ($posts) : foreach(
   $posts as $post) : start_wp(); ?> <?php the_date('','<h2>','</h2>'); ?> <h3>"
   rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title();?
   ></h3> <?php if($first) the_content(); if($first==$fullposts) $first = False;
   else $first++; endforeach; else: ?> <?php _e('Sorry, no posts matched your criteria.');?
   > <?php endif; ?>

Viewing 1 replies (of 1 total)

The topic ‘First post summary for Index.php’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [thr](https://wordpress.org/support/users/thr/)
 * Last activity: [21 years, 6 months ago](https://wordpress.org/support/topic/first-post-summary-for-indexphp/#post-103774)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
