Getting translate article by id
-
Hi, i’m writing a custom api, in order to get some CPT in my mobile app.
I use standard WP_Query in order to do that like:$args = array( 'post_type' => 'ovp_gallery', 'posts_per_page' => 10 'orderby' => 'post_date', 'order' => 'DESC', ); $query = new WP_Query($args); while ($query->have_posts()) { $query->the_post(); $content = get_the_content(); ... }
Default CPT are in Italian, but we have translated that in en_US. There’s a way to get all the info related to the CPT in en_US ?
I have tried:
$translated_content = trp_translate(get_the_content(), ‘en_US’);
but i don’t get the full content translate.
Some help ?
you can find an example of the api here:
https://www.startoltrepo.it/inverno/wp-json/oltrepo/v1/ultimi-post-eventi?lang=it
https://www.startoltrepo.it/inverno/wp-json/oltrepo/v1/ultimi-post-eventi?lang=en
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Getting translate article by id’ is closed to new replies.