Hola Roberto,
To create the translations button is not very difficult:
There are 2 functions that you need to check against the $postID
: pll_get_post_language
and pll_get_post_translations
With those functions, you can check which language version is available.
To create a Polylang translate button which links to the original, you have to create a Polylang nonce. This nonce is specific to Polylang and won’t work without it.
$nonce_url = wp_nonce_url( $url, 'new-post-translation' );
$url = '/wp-admin/post-new.php?post_type=YOURCPT&from_post='.$postID.'&new_lang='.$language_to_translate_to;
Hope this helps.
-
This reply was modified 2 years, 4 months ago by Massimo.
-
This reply was modified 2 years, 4 months ago by Massimo.
-
This reply was modified 2 years, 4 months ago by Massimo.