Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #339112

    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?

    #339362

    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

    #340035

    works, thanks for the good support you offer.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Change content of main-title entry-title’ is closed to new replies.