Skip Navigation

[Resolved] Issue with WPML and intermediary posts

This support ticket is created 2 years, 10 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/Hong_Kong (GMT+08:00)

This topic contains 13 replies, has 2 voices.

Last updated by Luo Yang 2 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2096077

Hi! I have two different content types that are connected by an intermediary content type with its own description field.

I have a view that's used on the template for content type 1. It's set to display posts of the intermediary content type "that are related to the Post where this View is shown."

And I'm using WPML to translate content type 1, content type 2, and the intermediary posts.

In my base language, English, things are working correctly. Example: hidden link. On the page for content type 1, it shows related items of content type 2. For each, the title and help link come from the original related post, and the description comes from the intermediary content type.

After adding translations for content type 1 and content type 2, things still basically work. The same list of resources shows up, with the title translated - for instance, on hidden link, see Centro de orientación profesional de Ferguson.

But when I then add translations for the intermediary post type, it breaks. The translated description shows up, but the title and link from the original post no longer do. For instance, "Información sobre carreras y preparación para exámenes" is a translated description. Before I translated the intermediate post, there was also a title and link there, along with the original English description. Once I added the translated description, those went away and left just the description.

What do I need to do differently to make this work?

#2096453

Hello,

The problem you mentioned above is abnormal, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

2) In case it is a compatibility problem, please deactivate all other plugins, and switch to WordPress default theme 2021, deactivate all custom PHP/JS code snippets, and test again

3) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2097457

Thanks for the details, I am downloading the files, will update here if find anything

#2097481

I can install the package file, please try these:
1) Edit the problem post "Encuentre un empleo":
hidden link
In section "Discover It Online list Online resources", there is one item connect with "Información sobre carreras y preparación para exámenes", you did not translate the intermediary post: Discover It Online list Online resources: 35 - 30

2) You can translate above intermediary post manually:
hidden link

#2097929
before-translation.PNG
after-translation.PNG

Right, I did not translate most of the intermediary posts yet, because when I do, it breaks my view. See the attached screenshots for before and after I translate Discover It Online list Online resources: 35 - 30. Before I add the translation, it shows the description from Discover It Online list Online resources: 35 - 30 and the title from hidden link, which is the translation of the post in question. After I add the translation, it only shows the description, and the title goes away. That's what I'm trying to prevent.

#2099583
location-technology-english.PNG
location-technology-spanish.PNG
location-technology-translation.PNG

More about this - I tested a similar scenario where there are another 3 content types (location, technology, and location + technology intermediate post), and a view that uses the relationship and displays some fields from the technology and some from the intermediate post. In that case everything works - here's the English version, then one with just the location and the technology translated, and then one with the intermediate post also translated. All good.

This makes me think there must be something specific about the views and/or content types in the original issue that's making it not work, but still not sure what that may be...

#2101049

Thanks for the details, I am checking it in my localhost, will update here if find anything

#2101077

Please try these:
Edit the post view "Online resource description for list":
hidden link

In section "Loop Editor", replace the content template shortcode from:
[wpv-post-body view_template="loop-item-in-online-resource-description-for-list"]

To:
[wpv-post-body view_template="loop-item-in-online-resource-description-for-list" item="@discover-it-online-list-online-resource.parent"]

In section "Loop item in Online resource description for list":
Remove all item="@discover-it-online-list-online-resource.parent" attributes, and test again

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

#2101637
find-a-job-after.PNG
find-a-job-before.PNG

I gave that a try, and now instead of the title disappearing when I add a translation, the whole entry disappears. See the attached before and after - when I translate the intermediate post with the description for Biblioteca LearningExpress, the whole Biblioteca LearningExpress section disappears.

#2101737

OK, figured out the difference between this view and the one in https://toolset.com/forums/topic/issue-with-wpml-and-intermediary-posts/#post-2099583 where things are working. In the Content Selection section for that view, it's set to post type = technologies, and fields from the intermediate post are using item='@location-technology.intermediary'. That works.

In the "Online resource description for list" view, the Content Selection section is set to post type = Discover It Online list Online resources Intermediary Posts. When I make an otherwise duplicate view with post type = Online resources instead, and switch to using item='@discover-it-online-list-online-resource.intermediary' where I need fields from the intermediary post, it basically works. I can add translations for all 3 content types, and the relevant fields show up as expected.

There's still a problem, though, which is that the reason I was using post type = the intermediary posts was so I could sort based on an order field from the intermediary posts. That's useful because the same resource may need to show up on different lists in different orders.

It seems to me like a possible bug with the WPML integration that setting up the view based on one content type works with the translations, but setting it up based on the intermediary content type breaks as translations are added. It's the same content types and the same relationships either way, so shouldn't either approach work?

#2102855

Thanks for the details, I am trying to reproduce the same problem in a fresh WP installation, will update here if find anything

#2104603

I can duplicate the same problem in my localhost, and have escalated this issue, will update here if there is anything found.

In your case, in order to sort the result by the "order field", it is required to setup the "order field" in the intermediary post type, and it needs to setup the view to query intermediary posts, so please wait for the update from our developers.

#2107869

Great, thank you!

#2108227
dcl2.JPG
relation-filter.JPG

Here is the feedback from our 2nd tier supporters, this kind of problem will not be fixed easily, and you can try below "nested view" workaround:
1) Create a post view "related-online-resources-posts":
- Query "Online resources" posts,
- Filter by "Filter by post relationship or repeatable fields group owner":
Select posts in a Discover It Online list Online resources relationship that are a related to the current post in the loop.
See my screenshot "relationship-filter.JPG"
- In view's loop, display "Online resources" post information, for example:

<h2>
  <a href="[types field='resource-url' output='raw'][/types]">
  [wpv-post-title]
  </a>
</h2>
[wpv-conditional if="( $(wpcf-resource-url-secondary) ne '' )"]
  <p>[types field='resource-url-secondary' title='[types field='resource-secondary-url-name'][/types]' ][/types]</p>
[/wpv-conditional]
[types field='help-link' title='Help and more info for [wpv-post-title]'][/types]

2) Edit the post view "Online resource description for list"
hidden link
In view's loop, display above view's shortcode + current intermediary post information, for example:

...
	<wpv-loop>
[wpv-view name="related-online-resources-posts"]
<p>[types field="resource-list-description"][/types]</p>
	</wpv-loop>
...

It works fine in my localhost with your duplicator package, see my screenshot dcl2.JPG

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