How to determine if current page is a child of another
-
I have a navigation bar made up of links to six pages. I have more than six pages overall, and each of the six in the navigation has child pages. The links to the pages are hand coded – I’m not using
wp_list_pages
.I am trying to give the appropriate link in the navigation
class="current"
when on either that page or a child of that page (so if on page ‘foo’ or child of ‘foo’, the link to ‘foo’ in the nav hasclass="current"
). Due to the host this is on refusing to install ISAPI_rewrite (IIS equivalent of mod_rewrite), I can’t do this by comparing the URL to anything (if you have a page ‘bar’ as a child of ‘foo’, the pretty URL would be /foo/bar, so you could say “if URL contains ‘foo’, addclass="current"
“. I’m stuck with “/?page_id=X”).So – is there a way of determining if the current page is a child of another page? I wish to be able to say “if current page is page X or a child of page X do this, else do that”.
Thank you for any help you can offer!
- The topic ‘How to determine if current page is a child of another’ is closed to new replies.