This plugin is easy to use and very basic in its concept. It will recursively test if the page you pass into this function is the current page or ancestor of that page. You can pass either a page ID or page name and it will return true or false. For example, if I wanted to test that the current page I'm viewing is the About page or one of its ancestors, I would then use the following code to echo current_page_item
if the function returns true.
<?php if (is_page_or_ancestor('about')) { echo 'current_page_item'; } ?>
To install, simply unzip the download provided and follow these steps:
- Place the
is-page-or-ancestor
folder into your /wp-content/plugins/
directory
- Activate the plugin through the 'Plugins' menu in WordPress
To uninstall the plugin, please perform the following steps.
- Deactivate the plugin through the 'Plugins' menu in WordPress
- If desired, remove the
is-page-or-ancestor
folder from your /wp-content/plugins/
directory