Skip Navigation

[Resolved] WPML and post relationships

This support ticket is created 2 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by matthewC-9 2 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#2151581

Hi! I have two post types that are connected by a relationship. Both types are translated via WPML. Things are currently set up so that if the related post exists in both the default (English) and translated (Spanish) languages, it shows up on both versions of the page. If the related post only exists in the default language, it shows up on the English version of the page but not the Spanish version. So far so good.

Now I'm trying to set up a relationship between two posts only in the translated language, not in the default - there is no English-language equivalent for the related post in this case. I found this thread - https://toolset.com/forums/topic/post-relationships-wpml-default-language/ - which seemed to imply that it should work if I create the related post in both languages but only connect it in the second language. But that doesn't work - if I connect the posts in English, it carries over, but if I only set the connection in Spanish, the related post doesn't show up at all.

What do I need to do to set up a working relationship only between the non-default / Spanish versions of the two posts?

#2152347

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

Your observation is correct and by design, the post-relationships are defined between the primary language posts only, and no direct post relationship is maintained between secondary language posts.

The secondary language relationships are dependant on the post-relationship in the primary language posts too and the translation setting and translation status of the two primary language posts.

For this reason, you'll need to make sure that every post exists in the primary language and the relationships are also created between the primary language posts.

regards,
Waqar

#2152727

Hi Waqar,

Thanks for the response. But, this is something we need to figure out how to do. Can you help come up with a workaround?

Basically, on hidden link, the boxes (For Kids & Families, Get a Library Card, Support Your Library, etc) are a content type called feature that is connected to the page content type. We need to be able to have a feature show up on hidden link that doesn't correspond to one on hidden link. It's fine if that feature has an English version in the database, but it needs to not actually show up on the page. Is there any way to do that?

Thanks--

#2153671

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these details.

If your goal is to make specific "feature" posts available only in a specific language, you can follow these steps:

1. You'll make sure that for each "feature" post, both EN and ES versions are available and the relationships are created with respect to the EN (primary) version.

2. You can add two new checkbox type custom fields "Available in EN" and "Available in ES" to this "feature" post, which will determine which feature post should be available in EN language and which should be available in ES language.

3. Next, whenever you need to show the list of "features" posts on the front-end, you can show them only in the allowed language, using custom code and conditional output.

You'll find a good usage example with a code snippet in this thread:
https://toolset.com/forums/topic/conditional-output-language/#post-402783

I hope this helps and please let me know if you need any further assistance around this.

#2156419

Thanks, Waqar - that sounds like what I'm looking for! I'm going to test it out and will re-open this ticket if I run across trouble, but I think that will do it.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.