Support » Fixing WordPress » post__not_in excluding children as well? how to?

  • Hello,

    I’m trying to display on my homepage a list of the last Posts + a list of the last Pages.
    Below, how my Pages Loop looks like (it basically works).

    My problem is that when I remove Pages, using ‘post__not_in’, it also removes their children. But what I want if for those children *only* to show.

    Example: I have a Guides category (635), with a few countries in it (675,986,1022,etc.)
    Every country Page has children guides, those are the one I want to show in the loop. I don’t want to show the country pages, because they are just indexes, not proper articles.

    Many thanks for your help!

    <?php /*loop for pages*/
    	$parent = $post->ID;
      		'post_parent' => '635',/*parent=guides*/
      		'post__not_in' => array(675,986,1022,1041,1070,1594,1713,2138,2467,2478,2486),/*country pages*/
       		'post_type' => 'page',
      		'posts_per_page' => '2',
      		'orderby' => 'date',
      		'order' => 'DESC'
    	 while (have_posts()) : the_post();

    [ Please do not bump, shamelessly or otherwise. That’s not permitted here. ]

  • The topic ‘post__not_in excluding children as well? how to?’ is closed to new replies.