In a theme I’m building, there are two main types of page. One is a product-gallery, one is for general info. I’d like to use wp_get_pages()
or wp_list_pages()
twice in the sidebar, one with a list of one type of page, and one with the other.
I don’t want to hard-code include
or exclude
in either list, as I can’t predict which page IDs will be which type of page. So I’d like to do something like:
wp_list_pages(‘type=gallery’)
and
wp_list_pages(‘type=page’)
What technique should I be using here?
1 Answer
Create a hierarchical custom post type, then pass post_type
to wp_list_pages:
$args = array(
'post_type'=>'gallery'
);
wp_list_pages( $args );