Hi
Please there are someone who can tell me how can I select with query_posts() just the pages with ID 5, 143 and 145.
Thanks..
Hi
Please there are someone who can tell me how can I select with query_posts() just the pages with ID 5, 143 and 145.
Thanks..
<?php
$type='post'; //or $type='page'
$args=array(
'post_type' => $type,
'post__in' => array(5,143,145),
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo 'List of '. $type . '(s)';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p> <?php the_category(', '); ?> -
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
} //if ($my_query)
wp_reset_query(); // Restore global post data stomped by the_post().
?>This topic has been closed to new replies.