php - Wordpress - Get higher hierarchy posts -
i'm trying create menu based on higher hierarchy posts custom post type. thing is, can't find way filter hierarchy get_posts function.
this have far...
                  <?php                      $args = array(                         'orderby'          => 'post_date',                         'order'            => 'desc',                         'post_type'        => 'pb_progproy',                         'post_status'      => 'publish',                         'suppress_filters' => true                      );                     $posts = get_posts( $args );                     foreach( $posts $post ){                     ?>                     <li>                         <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>                     </li>                     <?php } ?> i know give me posts regardless of it's hierarchy. need ones higher hierarchy.
any ideas?
let's figure posts structure..
post 1    post    post b post 2 i want post 1 , post 2 returned get_posts function. there way?
if you're using parent-child hierarchy, can parent posts filtering posts "post_parent = 0"
<?php  $args = array(     'orderby'          => 'post_date',     'order'            => 'desc',     'post_type'        => 'pb_progproy',     'post_parent'      => 0     'post_status'      => 'publish',     'suppress_filters' => true  );  $posts = get_posts( $args ); you can read more post filters here.
Comments
Post a Comment