Home » Wordpress » wordpress wp_list_pages help

wordpress wp_list_pages help

Posted by: admin November 30, 2017 Leave a comment


In my wordpress enviroment, I have a number of pages, and I also have a custom post type called casestudy. I have setup a page-clients.php that has some of it’s own content on, I then use the query_posts() function to pull in all the posts with the post type casestudy.

When viewing a single case study I wanting to show a nav, this nav needs to contain the links to pages, clients, and case study and underneath case studies I want to add all the posts that are of the custom post type ‘casestudy’ so far I have following,

<?php wp_list_pages(array('include' => '154, 136', 'title_li' => '', 'sort_column' => 'ID', 'sort_order' => 'DESC', 'depth' => '1')); ?>

How can I lists all the casestudy posts also, can it be done with wp_list_pages()


From the WordPress documentation:

$args = array( 'post_type' => 'product', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
    echo '<div class="entry-content">';
    echo '</div>';

You could have something like:

$args = array( 'post_type' => 'casestudy');
$case_studies = new WP_Query( $args );