How to: Show parent page title regardless of what subpage you are on


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. if($post->post_parent) {
  3. $parent_title = get_the_title($post->post_parent);
  4. echo $parent_title;
  5. } else {
  6. wp_title('');
  7. }
  8. ?>

URL: http://www.wprecipes.com/how-to-show-parent-page-title-regardless-of-what-subpage-you-are-on

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.