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

    Hello Enfold Team,
    You’ve graciously helped me to replace the Blogs – Latest News title with the single post title. ref: https://kriesi.at/support/topic/latest-blogs-function-php-code-displaying-the-fix/

    That worked really well. However, with each new custom post via a plugin using the post type, I’m running into the same issue where the Static text is displaying rather than the title. My goal is to always use the TITLE rather than the static Blogs – Latest News. Is there a way to wildcard all post types no matter what to use the post title?

    Thanks for your help.

    An example of a plugin using the post type for a custom content type is:

    #355369

    Hey Julie!

    I didn’t test this but it looks like you’ll want to change the code to this.

    add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
    function fix_single_post_title($args,$id)
    {
        if ( is_singular('post') || is_singular('your_post_type') )
        {
            $args['title'] = get_the_title($id);
            $args['link'] = get_permalink($id);
            $args['heading'] = 'h1';
        }
    
        return $args;
    }

    And change ‘your_post_type’ to your custom post type slug.

    Regards,
    Elliott

    #361844

    Elliott –
    The code you’ve provided worked well when replacing the previous code (ref support ticket above) in the functions-enfold.php. The custom content type title now displays instead of “blogs”. Nice work – I am thankful for your support.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Custom Post Types and’ is closed to new replies.