i have a page template as start page(home.php). i use a 2 columns grid to display all pages on that home.php with title and excerpt. unfortunately also my child pages are shown and i can’t figure out how to hide them.
I am not trying to make a list menue or something, its more like a gallery of my pages.
for now i use “query_posts(‘post_type=page’ .$parent);” with the mentioned result. i tried to use an array as well, but this will give me posts instead of pages (fr reasons i havnt understood yet).
What am i missing to hide all child pages and only display the parent pages?
Any help?
Thanks in advance!
Dan
There is a parameter in WP_Query called post_parent. Normally this refers to the ID of the post’s parent, but since its an integer field, pages without a parent have in essence a post_parent of 0.
So, to get all pages that are not child pages of another page, you could use
or, in array syntax that would be