Reputation: 468
I used this code
post_title; wp_list_pages('title_li=&child_of=$menu_name&depth=2'); ?>Any help.Thanks in advance.
Upvotes: 1
Views: 1544
Reputation: 2462
Check this plugin: JQuery Accordion Menu Widget
Create the menu you want using WordPress Menu (Dashboard -> Appearance -> Menus) and use the above plugin to display your menu on sidebar with Accordion effect. :)
UPDATE
The following code List Sub-Pages, if you are on a parent page and have some child. Place this code on your sidebar.php
<?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 } ?>
Check this wordpress codex section for more details
Upvotes: 1