Page links and out-of-loop content translations
-
I don’t seem to be able to find any reference to either of these in the docs, if it’s covered please just point me to the right place ??
So the simpler one first: page links. How do you create links to pages while maintaining the correct language? Menu’s are covered in the docs, but if I want to include a link to, say, my Contact page, on the About page, how do I do it while maintaining the currently set language?
i.e. this is how I’d normally approach this:
<a href="<?php echo get_page_link(69); ?>">I am a link</a>
However this obviously hard-codes the ID, which is different for each language.
—
Secondly, when using ACF how do I pull out-of-loop content using the correct language?
i.e. this is how I’d normally pull a specific field from a custom post type:
<?php echo get_field( "meta_title", 20 ); ?>
But this has the same issue as above, the ID is hard-coded, whereas I need to pull the correct ID based on the selected language.
Any help appreciated.
- The topic ‘Page links and out-of-loop content translations’ is closed to new replies.