I've searched the forums and haven't found an easy solution to this problem.
I want the first post display to be the full post, then all others to be excerpts.
Is there an easy way to do that?
I've searched the forums and haven't found an easy solution to this problem.
I want the first post display to be the full post, then all others to be excerpts.
Is there an easy way to do that?
Hey folks,
I have almost the same problem. I have created a page template I want to use as my first page. The page shows a normal WP page and I'd love to list last five posts of my actual blog under the page. I have tried many plug-ins but they all seem to have some problems to function properly in the page template.
Can anybody help?
Visiblemedia, this shouldn't be too hard. Maybe it's something like this:
This will get your first post:
<?php
$my_query = new WP_Query('showposts=1');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
?>
<?php the_content(); ?>
<?php endwhile; ?>
To get your next posts:
<?php $posts = get_posts('numberposts=4&offset=1');
foreach ($posts as $post): setup_postdata($post); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>
Of course, you'll have to format that with XHTML, and add whatever else you want -- post meta, time and date, title, etc.
Put this code into your home.php or index.php file.
Zqw, I think you should just be able to add the code below to make it work.
<ul>
<?php $posts = get_posts('numberposts=5');
foreach ($posts as $post): setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
That'll give you a list of the last 5 posts.
This topic has been closed to new replies.