Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1374360

    Hi Support,

    Thanks for including the functions.php code for removing “Blog–Latest Posts” as the default page title for posts in the Enfold documentation. I have recently put together some code to utilize the lowest (most specific) category level as the page title it works nicely for the project I am working on. I’ll include it below for reference and in case anyone else may find it useful.

    add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
    function fix_single_post_title($args,$id)
    {
    if ( $args['title'] == 'Blog - Latest News' )
    {
        $post_categories = get_the_category();
        $categories_by_id = array();
        foreach ( $post_categories as $category ) {
        $categories_by_id[$category->cat_ID] = $category;
        }
        foreach ( $post_categories as $category ) {
           unset( $categories_by_id[$category->category_parent] );
    }
    $args['title'] = $category->cat_name;
    $args['link'] = get_permalink($id);
    $args['heading'] = 'h1';
    }
    
    return $args;
    }

    However, I’ve noticed a peculiar phenomenon: when using ALB to edit a post, the post title shows as the page title, circumventing the code above–and the original code from your documentation as well. The switch to ALB seems to make that permanent, even if the post is later reverted to the classic editor. I shouldn’t be the only one who is experiencing this, so it seems relevant to post publicly.

    I’d really like to be able to use ALB and have the page title work as it does when the classic editor is utilized. Editing with ALB shouldn’t change the behavior of the page title (unless it offers options which further enhance the editing experience–and the ability to opt out.)

    Any ideas on a solution?

    Thanks,

    BP

    #1374553

    Hey Burnt Pixel,

    Thank you for the inquiry.

    It is possible that the following condition in the filter is not being met, which prevents the title modification from being applied.

    if ( $args['title'] == 'Blog - Latest News' )
    

    Where can we check the issue? Please provide the site URL and an admin account so that we can check the issue properly

    Best regards,
    Ismael

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