Plugin Directory

Is Page or Ancestor

Recursively test if the page you pass into this function is the current page or ancestor of that page.

Download Version 1.1

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'; } ?>
Author: Derek Herman

Requires: 2.5 or higher
Compatible up to: 3.0.5
Last Updated: 2010-6-9 Downloads: 688

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(7 ratings)

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

Log in to vote.

100,1,1
100,1,1 100,1,1
100,3,3
100,2,2
100,1,1
100,1,1