Tagged: 

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

    Hi, I’m using Enfold. I enabled breadcrumbs on pages. I’m displaying page title (left side) and breadcrumbs (right side). Is it possible to replace the page title (left side) with custom data.

    Example: Instead of the page title, I want to display…
    – “Press” on all press release pages
    – “Success Story” on all success story pages
    And so on…

    #1416645

    Hey Celeranttechnologycorp,
    First ensure that the Custom Fields option is enabled in the Screen Options at the top of your page in the Classic Editor:
    Enfold_Support_2989.jpeg
    Or in the Block Editor, go to Preferences ▸ Panels ▸ Custom Fields:
    Enfold_Support_2991.jpeg
    Then add a custom field custom_title and enter the value you want:
    Enfold_Support_2993.jpeg
    Then add this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    add_filter( 'the_title', 'custom_field_title', 10, 2 );
    function custom_field_title( $title, $post_id )
    {
        if( $new_title = get_post_meta( $post_id, 'custom_title', true ) )
        {
            return $new_title;
        }
        return $title;
    }

    and your custom title will show in the title bar:
    Enfold_Support_2995.jpeg

    Best regards,
    Mike

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