I have a blog with where I post in English and my girlfriend in traditional Chinese. I have tried to add a script that changes the HTML Lang tag depending on if its me or her that is the post author.
The script just outputs the same regardless of author for some reason, but if I move it further down in the header.php
it echos correctly. Anyone have any idea what i do wrong or have any other suggestions on how to solve it?
Here’s the code I’m currently using:
Ultimately I would want it to change the HTML Lang between three different states depending on the URL rather than author, so if anyone know how to do that – I’ll be eternally grateful! example:
If: example.com/**en**/blogpost-in-english/
then = html lang=en-AU
If example.com/**cn**/blogpost-in-chinese/
then = html lang=zh-TW
(Traditional Chinese)
if example.com/**zh-cn/cn**/blogpost-in-chinese/
then = html lang=zh-CN
(Simplified Chinese)