Recursively test if the page you pass into this function is the current page or ancestor of that page.
Author: | Derek Herman (profile at wordpress.org) |
WordPress version required: | 2.5 |
WordPress version tested: | 3.0.5 |
Plugin version: | 1.1 |
Added to WordPress repository: | 29-05-2009 |
Last updated: | 09-06-2010
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 78 |
Rated by: | 8 |
Plugin URI: | http://valendesigns.com |
Total downloads: | 1 049 |
Click to start download |
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'; } ?>