Hi
I wish to change Blog – Latest News to ‘Recipes’ on all posts. I’ve tried implementing this snippet, it doesnt seem to work
Also need to change link so it goes to recipes page rather than home page
Can you advise please
Kind regards
Duncan
sorry meant to include link see below
Hi,
When I test this snippet on my test site it seems to work correctly:
add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
function fix_single_post_title($args,$id)
{
if ( $args['title'] == 'Blog - Latest News' )
{
$args['title'] = get_the_title($id);
$args['link'] = get_permalink($id);
$args['heading'] = 'h1';
}
return $args;
}
Please include an admin login in the Private Content area so we can examine.
Best regards,
Mike
Hi Mike
I still see Latest News even though I’ve added recipies to snippet… see link
Hi,
Unfortunately I’m not able to login, I get an error that the user name is not valid.
You misunderstand the function, where you edited it looks for Blog – Latest News and then changes it to the title of the post.
The title of your post is Portuguese Pork and Garlic – Rick Rodgers, not recipies so recipies will not show.
To show recipies try this instead:
add_filter('avf_title_args', 'change_single_post_title', 10, 2);
function change_single_post_title($args, $id) {
if ( $args['title'] == 'Blog - Latest News' ) {
$args['title'] = 'Recipes';
$args['link'] = get_permalink($id);
$args['heading'] = 'h1';
}
return $args;
}
Best regards,
Mike
Many thanks Mike
thats a perfect fix :)
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