Get page link via code
-
Hy,
I’m trying to put in my template the link to other page, based on the current page.
Let’s say I have
foo.com foo.com/de foo.com/contact foo.com/de/kontakt
So when I’m at “foo.com” I need a link to “foo.com/contact”, and when the language changes and its set to german I have “foo.com/de” and I need a link to “foo.com/de/kontakt”.
I tried with:
$page_id = get_queried_object_id(); pll_the_languages(array('post_id' => $page_id)) echo '<a href="'. $the_current_language_link_to_some_page .'"></a>';
But it returns the list of the languages (the language switcher).
I can’t find the right way in [the docs](https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/).
Tnx
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Get page link via code’ is closed to new replies.