• I want to target pages that are NOT subpages of a certain page.

    Ideally, something like this:

    !$post->post_parent == '731'

    However, that doesn’t work. Is there another way?

Viewing 1 replies (of 1 total)
  • I think you can put this just before your query to do what you want:

    function mam_posts_where ($where) {
       global $mam_global_where;
       if ($mam_global_where) $where .= " $mam_global_where";
       return $where;
    }
    add_filter('posts_where','mam_posts_where');
    $mam_global_where = ' AND post_parent <> 731 ';

    Of course, the function and the add_filter could also go in functions.php, leaving just the variable assignment before the query.

Viewing 1 replies (of 1 total)
  • The topic ‘target pages that are NOT subpages of a certain page’ is closed to new replies.