I am a developer rolling a custom theme based on Bootscore, and I am wondering if there's any function to get the link to a certain page in the current language.
Example: I have a page "shipments" in the base language (english) and I have a translated slug as "envios" for spanish language.
In standard WP I'd use home_url("shipments") to get the page url but wp_home_url("shipments") will only yield the home page in the language, not the shipments page as expected ("/envios").
Hi Andreas! Thanks both links are really useful. wpml_element_link() might be the closest to what i'm looking for. I've wrapped in function (see below) to call it by slug which is more preferable. I'd prefer to have a wpml_element_url() function that only brings the url without the to provide styling etc, but this is close enough.
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.