Tagged: breadcrumbs
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…
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:
Or in the Block Editor, go to Preferences ▸ Panels ▸ Custom Fields:
Then add a custom field custom_title and enter the value you want:
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:
Best regards,
Mike