Get URL for different languages
-
Hey there ,
I am doing some SEO stuff and want to implement the Hreflang Tag.
I am almost there ,however I have a few problems.
1.How can I obtain the site url for different languages?
-Basically a function that will get the url for different domains.Rignt now its based on language , for example in english it is example.com/en , and for default language it is example.com.
2.Get list of all active languages , right now I have hardcoded my languages
$languages = array('en_GB' , 'bg_BG');
I want to do it dynamic for the code to be cleaner.
3.The last one.How to obtain the different category url for different language.
I am using this code for the ‘post’ and ‘page’ urls , but it doesnt seem to work for the category ,since the ID is different for different language.
get_permalink( icl_object_id( get_the_ID() , 'post', true , $code) )
- The topic ‘Get URL for different languages’ is closed to new replies.