/ Published in: PHP
Wordpress hierarchical sidebar nav using wp_list_pages
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if($post->post_parent) { $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&sort_column=menu_order&exclude=88,93,91"); $titlenamer = get_the_title($post->post_parent); } else { $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&sort_column=menu_order&exclude=88,93,91"); $titlenamer = get_the_title($post->ID); } if ($children) { ?> <ul class="sidebar_nav"> <?php echo $children; ?> </ul> <?php } ?>