Trouble adding grandchildren to a menu
-
I’m trying to display the grandchildren of a page, and I’ve figured out how to display the children, but I’m not sure how to integrate the code for displaying the grandchildren too. Here’s what I have so far:
<ul class="ancestor_menu"> <?php foreach ( $children as $child ): global $wp_query; $postID = $wp_query->post->ID; if($postID === $child->ID) { $active = ' class="current-menu-item"'; }; ?> <li<?=$active?>><a href="<?php echo $child->guid; ?>"><?php echo $child->post_title; ?></a></li> <?php unset($active); endforeach; ?> </ul>
- The topic ‘Trouble adding grandchildren to a menu’ is closed to new replies.