/ Published in: PHP
Yes this works, needs css ...
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php global $wp_query; $post = $wp_query->post; $ancestors = get_post_ancestors($post); $parent = $post->ID; } else { } if(wp_list_pages("title_li=&child_of=$parent&echo=0")) { ?> <ul> <?php wp_list_pages("title_li=&child_of=$parent&depth=0"); ?> </ul> <?php } ?> .children {display: none} .current_page_item ul.children, .current_page_ancestor ul.children, .current_page_parent ul.children {display: block}