[Resolved] Get parent page title, or if no parent, get current page title.
Hello again guys.
Ok this is a strange question, because you wouldn’t normally want this, but here goes.
I’m looking for some code that is basically an if function:
Page has parent? YES: Get parent title. NO: Get current page title.
It sounds simple to me, but I’m having trouble intergrating the two.
Here’s what I’ve got so far. This is to call just the parent title (so it only works if I’m on a sub page):
<?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?>
Anyone know how to create the whole function?
Thanks in advance. Also, my site if anyone’s interested: http://www.pullupbarsx.com
[No bumping, please.]
- The topic ‘[Resolved] Get parent page title, or if no parent, get current page title.’ is closed to new replies.