is_subpage() function
-
I’m looking for some help or guidance on the workaround for the is_page() function.
On the Conditional Tags « WordPress Codex page there is a little line and work around that says:Unfortunately, there is no is_subpage() function yet. There is, however, a workaround.
if(get_the_title($post->post_parent) != the_title(' ' , ' ',false)) { echo "This is a subpage"; }
determines if the executing page is a subpage by checking if it isn’t it’s own parent (non-subpages (pages) are their own parent). In this case, it will print “This is a subpage” to the browser.my php is a little below marginal, but i’m sure there could be some logic that could determine if it isn’t it’s own parent, but it does have a parent, what’s its parents ID.
yes? no?
help, please?
thank you.
- The topic ‘is_subpage() function’ is closed to new replies.