Forums
Forums / Fixing WordPress / sub sub sub menu (three levels)
(@ecdq)
15 years, 4 months ago
I have this pages menu :
a -aa –aaa –aab –aac -ab -ac
On the page aa, I want to show the wp_list_pages aaa, aab & aac, If I’m on the page aaa, I want to show aaa, aab & aac (nothing else). How can I achieve this? For now, I have this code (and it’s only working for the second level)
<?php global $wp_query; $post = $wp_query->post; $ancestors = get_post_ancestors($post); if( empty($post->post_parent) ) { $parent = $post->ID; } else { $parent = end($ancestors); } if(wp_list_pages(“title_li=&child_of=$parent&echo=0” )) { ?>
<div id=”secondary-nav” role=”navigation” class=”menu”>
</div><!– #secondary-nav –>
Thanls for your help!
The topic ‘sub sub sub menu (three levels)’ is closed to new replies.