Hello,
i have a problem with toolset.
Within a post "Brics Laboratory" (hidden link) I related the posts "Observatory documents" each one is translated into 2 languages (not all and now I'll explain what happens).
When I "link" an "observatory document" in the Italian language (hidden link), if it also exists in English I can see it correctly also in the English language (hidden link).
The problem arises if I have an "observatory document" not translated into English, in the front-end and also in the list of back-end documents it shows me the linked post in Italian. Instead the strange thing that I have also added some linked posts that are only in English (hidden link) and strangely it shows them to me only in English , does not have the same behavior as those in Italian.
How can I not show the documents in Italian in the post in English? That is, I would like the same behavior that it has for documents in English to have the same behavior for those in Italian, in the front-end I have to see only the documents of the correct language. Can I put an if in the view and filter the loop? Or is there another method? I wish they didn't even show up on the backend list ...
We were able to check that you are using WPML. By chance, in WPML -> Settings -> Post Types Translation, the ‘Observatory document’ post type has the ‘fallback’ option enabled? Screenshot: hidden link
The behavior that you have described is very similar to when this option is enabled. Could you please check it, and if it is indeed active, try to switch to ‘translatable - only show translated items’? I’m afraid that the issue will be solved after this.
Please give it a try and let us know how it goes. Thank you!
Hi Mateus,
thanks for the support I was able to solve the problem with the method you indicated to me.
I would like to ask you another question if I can ... I have a view with a loop that generates a list, how can I hide everything if there is a page where it does not find elements?
Let me explain, as you can see here: hidden link the div under the title "Documenti Allegati" is generated by the loop in my view ... in this case it does not find any related post ... I would like to hide the div with class = box-documents when there is nothing how can I do?
Thank you
Hi Mateus,
I can not use the conditional block in my template because I entered the code from php, nothing changes from template I tried ... this is the piece of php code:
How can I put a conditional out of view to completely hide this div? It is better to insert it from php because from the view I can only hide the shortcode part.
Can you help me? Thank you
Any checking needs to be done in the view itself. We are not able to check outside the view for anything within it since the view is loaded whether or not the data is available or not.
What might work is to use the wpv-conditional shortcode to first test if the field has a value or not before outputting it. So you would need to wrap the whole div contents in wpv-conditional shortcodes if you don't want the label to appear either. The technique is described generally here: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/