I use the title container on the header of my site. instead of showing me the Title. I want to place here the title of the parent page. Right now it shows the title of the current page.
Mega comfortable would be to check if there is a parent page and only show it if this is TRUE. ELSE show current Title. What do you think?
Hey!
Try adding this at the very end of your theme functions.php file:
add_filter('avf_title_args', 'fix_blog_page_title', 10, 2);
function fix_blog_page_title($args, $id)
{
if(is_page($id))
{
$parents = get_post_ancestors($id);
if(!empty($parents))
{
$id = $parents[count($parents)-1];
$args['title'] = get_the_title($id);
}
}
return $args;
}
Cheers!
Josue
works, thanks for the good support you offer.