is_child function
-
Hi.
This plugin is exactly what I am looking for, but I am trying to understand the logic required for the visibility field.
I have added the following function to my functions.php file:
function is_child($pageID) {
global $post;
if( is_page() && ($post->post_parent==$pageID) ) {
return true;
} else {
return false;
}
}and I am trying to use the following condition to display the menu item if the parent page is active or if a child of the parent page is active.
is_page(221) or is_child(221)
However it does not work, so if the function is correct, my logic is faulty.
Any suggestions would be appreciated.
https://www.ads-software.com/extend/plugins/menu-items-visibility-control/
- The topic ‘is_child function’ is closed to new replies.