First post summary for Index.php
-
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: https://www.startrekuk.com/.
This is simply a few if statements wrapped aroundthe 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(); ?></h3>
<?php if ($first){ ?>
<?php the_content(); ?>
<?php } ?>
<?php $first = False; ?>
<?php endforeach; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>
- The topic ‘First post summary for Index.php’ is closed to new replies.