This support ticket is created 2 years, 6 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hello,
I have a view that displays the values of various fields. Sometimes a field has no value. Then it would be nice to be able to output a message instead. For example "not available". How is this possible?
You can use a Conditional block to only output the label and the field if the field has a value (so if the field had no value it wouldn't output anything).
But if you wanted to display a message you would add 2 Conditional blocks, one to show if the field did have a value and another for what to show if it didn't.
One more question:
Something is strange: for posts where there is no value for a certain field, nothing is displayed despite the conditional query (a message "not available" should be displayed). Only after I have opened the post in the editor and saved it again does the message appear. What could be the reason for this?
I can't save all the posts again because there are >1000 posts...
It looks like you are using the legacy editor with shortcodes rather than the block editor, in which case I think you may need to manually edit the shortcode argument to use empty, like so:
[wpv-conditional if = "( empty( $(wpcf-indexer)) )"]
...or...
[wpv-conditional if = "NOT ( empty( $(wpcf-indexer)) )"]
Hi,
I created the content template in block editor and it is working fine for the other fields. Only one field show nothing until I open the page in editor and update it. After that the conditional is working. And after updating I also see the correct path in my breadcrumbs. See screenshots. Can you help me investigate this issue?
Thanks!
It might be a compatibility or cache problem, updating post will flush the post cache of some cache plugins, please try these:
1) deactivate all other plugins, and switch to WordPress default theme 2021
2) if the problem is fixed, then activate other plugins one by one, try to locate the problem plugin
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, also point out the problem page URL, I need to test and debug it in my localhost, thanks https://toolset.com/faq/provide-supporters-copy-site/
I have tried the database dump file in my localhost, there are some MYSQL errors when import it, some tables are missing, so this database dump file is not valid for debug, you can follow duplicator document to export the database only package files: hidden link
Thanks for the details, I can see the problem with your duplicator package.
The problem is: in those specific problem posts, post field "Heftnummer und/oder Seitenzahl", there is an empty space in the field value, it conducts the problem.
And in your case, I assume you are going to display the title "Heftnummer und/oder Seitenzahl" + fields, only when there is field value in it, if it is, please try these:
1) Edit the content template "Publikationen neu":
- find and select the conditional block for custom field "Heftnummer und/oder Seitenzahl", setup condition as screenshot not-empty.JPG
- Move the text title "Heftnummer und/oder Seitenzahl" into conditional block
2) Edit each problem "Publikation" posts, setup the custom field "Heftnummer und/oder Seitenzahl" values, save it, and test again
When I open a publication in the editor, I do not see a space in the field that remains empty. No matter what I enter in the field, nothing is displayed again after saving. Not even the message "not available". See this publication hidden link
That is very strange.
I have looked at other publications. Not only the field "Heftnummer und/oder Seitenzahl" has these errors, but also the field "Volltext".
For example, look at this publication hidden link.
Here, the "Volltext" field remains empty. Here, too, it is useless to change the content of the field in the editor and save it again.
I have adapted the content template as you wrote. It does not help.
Can you please further investigate the problem with the empty fields?
Thanks a lot and have a nice day!
Here is an addendum to my post:
I have deleted the publication where the "Volltext" field remains empty (hidden link) and created a new one. Nevertheless, the field remains empty and there is no "nicht verfügbar/not available" output. I also renamed the linked PDF file to exclude the possibility that it is due to some strange characters in the file name. This did not lead to success either...
I have tried again with the duplicator package file you provided, it works fine in my localhost using steps I mentioned above, if you need more assistance for it, please provide a test site with the same problem, fill below private message box with login details, I can setup a demo in your website