How to create a sub menu with custom post types?

I built a website with WordPress and I have custom posts types.
In some pages I have the subnavigation and I want to show it in the page like in the follow image:

http://www.andreavisibelli.com/screen-1.jpg

Read More

it works fine, isn’t it?

Yes but if you try to see “Vini” page as in the follow image you can’t see the sub-menu:

http://www.andreavisibelli.com/screen-2.jpg

The difference between the two submenus is that the first is filled of base pages of WordPress while the second is filled of custom post pages!

MY CODE IS:

  <ul id="subnavigation">
<?php
  if($post->post_parent)
  $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
  else
  $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
  if ($children) { ?>
  <ul>
  <?php echo $children; ?>
  </ul>
  <?php } ?>
  </ul>

How can I solve this problem?

Related posts

Leave a Reply

1 comment