On a French-language website, where I have deliberately chosen not to have a specific page for the blog, when I open a single article, in the “main-title entry-title” reads: Blog – A la une
How can I change main-title entry-title ?
For example, if I wanted “À la une” instead of “Blog – A la une”?
(See attach image on Private Content)
Best regards,
Oriano
Hey Oriano,
Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:
add_filter('avf_title_args', 'remove_blog_prefix_from_title', 10, 2);
function remove_blog_prefix_from_title($title, $id = null) {
if (is_single() && strpos($title['title'], 'Blog -') === 0) {
// Remove "Blog -" prefix
$title['title'] = trim(str_replace('Blog -', '', $title['title']));
}
return $title;
}
If you are not using a child theme you could use the WP Code plugin then add a new snippet, in the top right corner use the PHP snippet as the code type:
and ensure that it is activated, then add the above code and save.
Best regards,
Mike
Hi Mike,
thanks for your snippet. It work fine to hide the text “Blog -“.
And if I want to customise the entire title?
Would that be possible?
Best regards,
Oriano
Hi,
Then use this instead:
add_filter('avf_title_args', 'replace_blog_title_with_custom_text', 10, 2);
function replace_blog_title_with_custom_text($title, $id = null) {
if (is_single()) {
$title['title'] = 'Your Custom Title Here'; // Replace with your desired title
}
return $title;
}
Change ‘Your Custom Title Here’ in the code to suit.
Best regards,
Mike
Hi Mike, thank you very much for your help.
Best regards,
Oriano
Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.
Best regards,
Mike