I'm creating a site with 3 CPT and other 3 many-to-many relationship via CPT.
Also the site will be multilingual (using WPML) and I have some doubts:.
CPT posts will be multilingual (for each language, and display available language if one CPT is not translated), what about the post for the relationship? can I create a many-to-many relationship for posts in different languages? relationship should be also translated?
another question: it is possible to create lists for posts that are multilingual?
thanks
Q1) what about the post for the relationship? can I create a many-to-many relationship for posts in different languages? relationship should be also translated?
Yes, it is possible to create many-to-many relationship for posts in different languages, you just need to mark all related post types to be translatable, see WPML document:
https://wpml.org/faq/how-to-translate-custom-types/
And you will be able to translate the relationships.
Q2) It is possible to create lists for posts that are multilingual?
You can use Views shortcode [wpv-conditional] to check if current post has been translated, with WPML function wpml_element_has_translations():
https://wpml.org/wpml-hook/wpml_element_has_translations/
https://toolset.com/documentation/views-shortcodes/#wpv-conditional
Thanks for the reply, i need to add:
Q1.1: I don't need relations to be multilingual, i want to link CPT that are in different languages, ES_AR with EN_US and vice versa
Q1.2: so if i create a relationship with 2 the ES_AR posts i have to create another one for the EN_US translated versions?
Q2: when i make a list of post for the spanish version of the site, i want to list posts with default on ES_AR, and if a post does not have the ES_AR translation to show the EN_US. that for each post in the loop.
Will custom code be necessary?
Q1.1) and Q1.2) This is not possible within Types and WPML, you can not setup many-to-many relationships between between same post type of different lanuagage version (ES_AR and EN_US),
Q2) Yes, it needs custom PHP codes, you can the solution of WPML thread, for example:
https://wpml.org/forums/topic/display-default-language-if-no-translation-on-category-index-page/#post-272732
Ok thanks about that, one question about Q1.1 and Q1.2: what about creating many-to-many relationships between different custom post types (CPT1 in ES_AR linked to a CPT2 in EN_US).
Regards.
Sorry, there isn't such a build-in feature within Types or WPML, as I mentioned above:
You can setup the many-to-many relationships between different post types in same languaage.
Also you can check out our certified partners for it:
https://toolset.com/consultant/
OK, thanks for the support luoy