3

I would like to show all posts from a custom post type on one page with the ordering exactly like in the backend. I get the right ordering with wp_list_pages, but of course without the content.

  1. parent

    1.1-> sibling

    1.2-> sibling

  2. parent

    2.2-> sibling...

etc.

But I cant figure out how to set the order correctly with orderby.

Here is my code

    $args = array(
    'depth' => '0',
    'post_type'         => 'manual_documentation',
    'post_stauts'   => 'publish',
    'orderby'    => 'parent menu_order',
    'posts_per_page' => 10
    );

    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();

    echo '<h1>';
    the_title();
    echo '</h1>';
    echo '<div class="entry-content">';
    the_content();
    echo '</div>';
    endwhile;

The result:

  1. Parent

  2. Parent

    Sibling Sibling Sibling

Does anybody know how to solve this problem? Thanks!

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.