query_post not working
-
Hi all,
Weird problem here.
First off please know that I am displaying word press posts on an external site.
I have this at the top of my php document
<?php require('sportsblog/wp-blog-header.php'); ?>
This loop works:
<?php while (have_posts()): the_post(); ?> <h5><?php the_title(); ?></h5> <?php the_excerpt(); ?> <div style="margin: -15px 0 1em 15px"><a href="<?php the_permalink(); ?>">Read more...</a></div> <?php endwhile; ?>
This works but brings in all the posts from all the categories – not what I want. I want all post from category 5 (checked this multiple times). So I used the following loop:
<?php query_posts('cat=5'); ?> <?php while (have_posts()): the_post(); ?> <h5><?php the_title(); ?></h5> <?php the_excerpt(); ?> <div style="margin: -15px 0 1em 15px"><a href="<?php the_permalink(); ?>">Read more...</a></div> <?php endwhile; ?>
no posts at all show up.
This is the only loop on the page that I know of – there will be more in the future but for now I’m just trying to get this to work. I have tried resetting/changing the permalinks but it doesn’t help.
Any ideas why it woundn’t? ??
Thanks!
Daf
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘query_post not working’ is closed to new replies.