Not sure if this is possible without some form of hard-coding but I have a custom post-type called 'city'. Within the 'city' post-type I have some parent post (e.g. England, America and China) and some child posts (London, Washington DC and Beijing).
I have a query that displays all of the posts under 'city'. But for this particular query I'd like to actually ignore ANY parent posts (ie. England, America and China) and only display child posts (London, Washington and Beijing).
Here is the way I am coding my query:
<?php $city = new WP_Query(array('post_type' => 'city', 'orderby' => 'name', 'order' => 'ASC', 'posts_per_page' => -1 )); ?> <?php while ($city->have_posts() ) : $city->the_post(); ?> <?php the_title(); ?> <?php endwhile; ?>
So is this possible? I would have thought that doing the opposite is more of a popular question (displaying only the parents and excluding the children) but I'm hoping that my problem is possible!