Get current post’s child page?
$ancestors = array(); $ancestors = get_ancestors($post->ID,’page’); $parent = (!empty($ancestors)) ? array_pop($ancestors) : $post->ID; $parent should be the topmost page parent. However, if you are using a WordPress generated menu there is a pretty good chance that there is already a item identified by a CSS class as the parent. Take a good look at the … Read more