Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type that is set to have hierarchy. I'm trying to create a list of posts in that post type that display's that hierarchy using nested unordered lists. I have this post structure:

Post -child post -- child of child post -- child of child post

And I want to be able to create a list of posts (which i guess are behaving more like pages since they have hierarchy), that reflects this structure using unordered lists, like so:

<ul>
   <li>Post
      <ul>
       <li>child post
           <ul>
           <li>child of child post</li>
           <li>chld of child post</li>
           </ul>
       </li>
     </ul>
   </li>
</ul>

What's the best way to do this (if there is one) so that I don't have to go back into the code whenever I add new parent pages?

share|improve this question
add comment

1 Answer 1

<ul id="my_cutom_type-list">
    <?php wp_list_pages( 'post_type=my_custom_type&title_li=' ); ?>
</ul>
share|improve this answer
    
Haha. Wow, I feel stupid. Thanks. I somehow had it in my head that list_pages wouldn't work because they were "post" types and didn't even bother to try it. Thank you!. –  Appledore Jun 18 '11 at 3:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.