Showing an array of certain pages with WP_Query in Wordpress
Posted
by Ragnar
on Stack Overflow
See other posts from Stack Overflow
or by Ragnar
Published on 2010-04-08T09:05:55Z
Indexed on
2010/04/08
9:43 UTC
Read the original article
Hit count: 315
What I'm trying to achieve is showing only certain pages in a loop. 3 certain pages, not more, not less.
I've tried many things but I just can't complete it.
<?php
$special_tabs = new WP_Query(array('post_type' => 'page', 'post_in' => array(100,102,104)));
?>
What this does, from what I understand, is that it shows an array of pages and then includes those ID's there as well.
<?php
$special_tabs = new WP_Query(array ('page_id' => 100));
?>
And this shows only ONE certain page, it doesn't support the showing of array of different IDs.
I'm sure I am not the first person to have such specific needs and I'm certain there is a relatively simple way to achieve what I'm trying to achieve, but I just can't come up with a solution or to find one. Can anybody please help me with this?
Many thanks in advance!
© Stack Overflow or respective owner