More than one language
Reading in the right language
Nothing changes in your code. ugly_get() and ugly_show() give the value of the language of the visit:
On this page
You want: the value in the right language, on the page and on an options page.
On the page
<h1><?php ugly_show( 'headline' ); ?></h1> <?php // in the language of the visit ?>Nothing to add: ugly_show() and ugly_get() read the page being shown, and each language is its own page in Polylang.
A page in a specific language
$english_id = pll_get_post( get_the_ID(), 'en' );
ugly_show( 'headline', $english_id );On an options page
The same call gives the value of the language of the visit, or of the main language if that one was never written.
Did this article answer your question?
Thank you. It helps us make the documentation better. Need more help?