Your question is a little short on specifics.
1. have you use query_posts outside of the while loop? It must be called before the loop starts or you’ll get into a right mess.
2. have you actually called the loop and included the HTML to display the results? query_posts on its own won’t display anything!
Have a look at the Codex entry on the subject.
Finally, query_posts is an inefficient way of including posts, you should really consider building the query into the main WP_Query call instead.
Hope that helps
Peter
hi peter tnx for respondig
this is the code that i have in the file
<?php query_posts("p=1,2,3,4,5"); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
this return only post id 1
see all query_posts() parameter:
http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
(the same parameters work with query_posts())
Multiple Posts/Pages Handling
Display only the specify posts:
query_posts( array( 'post__in' => array( 1,2,3,4,5 ) ) );
Are you doing your own WP_Query call?
If not, then WordPress will already have done this for you, say on a single page or post, in which case it will already have filtered out all other posts, so you will only get the one. The only time using query_posts will work like that is in an archive or categories or search display.
You need to do your own query from scratch. You shouldn’t do this in the standard single.php or page.php otherwise it won’t work properly for when you do need to display single posts.
Rather, you should make your own page template file. Your PHP for that will then look something like this:
<?php rewind_posts(); ?>
<?php $recent = new WP_Query(); ?>
<?php $recent->query("p=1,2,3,4,5"); ?>
<?php if ( have_posts() ) : ?>
<?php while($recent->have_posts()) : $recent->the_post(); ?>
...
<?php endwhile; endif; ?>
alchymyth the code work
tnx guys