This thread is resolved. Here is a description of the problem and solution.
Problem:
I'm using a custom code, I want to display the translation posts in the second language and fallback posts in the original language if the translations are missing with a custom query and Ajax.
Solution:
Add the code below before the WP_Query in the Ajax callback function to show the fallback posts:
if ( class_exists( 'WPML_Display_As_Translated_Tax_Query' ) ) { global $sitepress, $wpml_term_translations; $wpml_display_as_translated_tax = new WPML_Display_As_Translated_Tax_Query( $sitepress, $wpml_term_translations ); $wpml_display_as_translated_tax->add_hooks(); }
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 15 replies, has 2 voices.
Last updated by 1 year, 2 months ago.
Assisted by: Long Nguyen.