trouble outputting current page title ONLY if it is the parent page
-
This is the first time I’m posting so excuse me if I don’t get it right ??
the page/section in question
https://atyantcapital.com.s42598.gridserver.com/about/1. on the left hand side, note that the top level page “About Us” is listed and below that, the child pages of the “About Us” page.
2. Now click on one of the child pages.
3. Note that the name of the current child page now appears where the words “about us” used to be
4. What I want is for the name of the parent page to always appear, now matter what child page the user is on.Here is the code:
<?php if(!is_home() and !is_search() and !is_single()) { /* For non-blog pages */ ?> <?php echo "<h4>";wp_title('');echo "</h4>"; if($post->post_parent) $children = wp_list_pages("sort_column=menu_order&depth=2&title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("sort_column=menu_order&depth=2&title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?> <?php } ?>
So wp_title is obviously outputting the current page, even if it’s a child page. What I need is the magic key to make the output there only be the name of a parent page.
If anyone can help, I’ll be eternally grateful. I spent time going thru the codex and the support forum but this is the one time I wasn’t able to find an answer.
- The topic ‘trouble outputting current page title ONLY if it is the parent page’ is closed to new replies.