I have a main menu on a wordpress site using wp_nav_menu that goes as 4 parent items, and each have a few sub menu items.
On particular template, I would like to show the submenu items for one of the parent items. For instance:
- Parent Item 1
- List Item 1
- List Item 2
- Parent Item 2
- List Item 1
- List Item 2
- Parent Item 3
- List Item 1
- List Item 2
- Parent Item 4
- List Item 1
- List Item 2
In my template I would like to show List Item 1 and List Item 2 for Parent Item 3. Each parent item has a unique ID. On 'pages' I use the following code to accomplish it:
<?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 id="side-page-menu">
<?php echo $children; ?>
</ul>
<?php } ?>
But that does not appear to work for single posts (compared to pages).
Thanks!
Tried with this