Displaying *only* posts on static page
-
I have a static non-wordpress page that I’m displaying excerpts from my latest posts on my wordpress blog. To do that, I’m using the following code:
This is placed at the top of the page.
<?php // Include WordPress define('WP_USE_THEMES', false); // Change path below to location of wp-blog-header.php on server require('/wordpress/wp-blog-header.php'); // Change number below to show 1 or more post excerpts query_posts('showposts=5'); ?>
This is placed within the page where I want to display the excerpts.
<?php while (have_posts()): the_post(); ?> <?php the_time('jS F') ?> <a href="<?php the_permalink(); ?>" title="Read full post"><?php the_title(); ?></a> <?php endwhile; ?>
The problem I’m encountering is that while it does display the latest posts exactly how I want it to, it’s also displaying excerpts to newly created static wordpress pages. All I want are the latest posts from my blog page, and not excerpts from other wordpress pages.
What needs to be changed to accomplish that?
I tried changing query_posts to get_posts but that did a lot of nothing. I also tried restricting the header code to specific categories only by changing'showposts=5'
to'cat=3&showposts=5'
, but that didn’t work either.I’m not familiar enough with the language to figure this one out. Any help would be greatly appreciated.
Thanks!
- The topic ‘Displaying *only* posts on static page’ is closed to new replies.