my site has the entire one in english except for several spanish pages…i want to change the html lang attribute to spanish for certain pages so the accessiblity screen reader can speak it in the right form
Hi @pbravin,
Thanks for reaching out.
You can add the following code into your child theme’s functions.php to change the locale for specific pages. You need to specify the page ids into the conditions.
add_filter('locale', 'my_get_locale');
function my_get_locale($locale)
{
if ( is_page( 2846) || is_page( 2847) )
{
return "es_ES";
}
return $locale;
}
Please find the following article on how to find the post ids: https://theme.co/docs/how-to-locate-post-ids
Please remember that the above code will work if copied as it is and don’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide support for custom codes that means we can’t fix it in case it conflicts with something on your site nor will we enhance it.
Thanks
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.