Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #275735

    Hi, congratulations (I´ll purchase my second license for sure…)

    What code must I use to set up the page title with the parent title (in case that page has a parent page)?

    When using sidebar, parent and child pages, and page title it would clarify the structure.

    Thanks.

    OSCAR

    #275756

    Hey!

    Try adding this at the very end of your theme functions.php file:

    add_filter('avf_title_args', 'parent_page_title', 10, 2);
    function parent_page_title($args,$id)
    {
    	$post = get_post($id);
    
    	$title = empty( $post->post_parent ) ? get_the_title( $post->ID ) : get_the_title( $post->post_parent );
    	$link = empty( $post->post_parent ) ? get_permalink( $post->ID ) : get_permalink( $post->post_parent );
    
        $args['title'] = $title;
        $args['link'] = $link;
    
        return $args;
    }

    Cheers!
    Josue

    #275780

    Just perfect!!!

    Best.

    OSCAR

    #275784

    You are welcome, always glad to help :)

    Regards,
    Josue

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.