Tell us what you are trying to do?
I have a lot of custom fields relating to a specific post. Many are blank. I want to display a list of all non-blank fields on a custom template. I have tried using conditional block with code such as...[wpv-conditional if=" NOT ( empty( $(wpcf-eyes)) ) " ] Eyes: [types field='eyes'][/types] [/wpv-conditional]. But not sure this is correct method AND this leaves blank lines in the resulting page when I dont want any line at all.
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site? hidden link
Hello,
I assume we are talking about this page:
hidden link
I have checked above page in my Chrome browser, those blank lines are outputted from HTML codes:
<p><span style="font-weight: 400;"></span></p>
These HTML codes are different from what you described above, I suggest you locate those HTML codes, try to remove them or wrap them into the [wpv-conditional] ... [/wpv-conditional] shortcodes, if you need assistance for it, please provide a test site with the same problem, fill below private message box with the test site credentials.
Thanks Luo,
Yes that is the correct page. I'm not even sure I am doing this list correctly. Is there an easier way using the blocks to get a list of the custom fields but ignore the ones that are empty? (and not leave spaces where the empty ones should be?
Within Toolset Blocks plugin, there is a built-in "Conditional Block", you can use it in the content template(Designed with Blocks editor), see our document:
https://toolset.com/course-lesson/using-toolset-conditional-block/
Hey Luo,
THe challenge I have 26 custom fields that could be in the list. To use the conditional blocks to say only show a field if it is not empty would require me to add 26 conditional blocks ( [wpv-conditional] ... [/wpv-conditional] shortcodes) each controlling if a custom field is displayed. I cant see anyway to use one conditional block to control all the custom fields.
I have little coding experience but would not know what code to add and where, if that is a better route.
I don't think there is other better rule for you, you just need to follow the document to setup the conditional blocks, and please let me know if you need more assistance for it.
I think it would be easier to edit so many conditional statements in the old editor but I tried converting the block into the tradition editor and I received a message saying there was no template and it would be reset and it did change the interface to the old views but I lost all the content. Is there any way I can see and edit the content in code somewhere?
You can setup the [wpv-conditional] shortcodes with Toolset "Fields and Text" block, in the "Fields and Text" block menu, you can add the "IF" button, and setup conditions, insert the the [wpv-conditional] shortcodes into content, switch to HTML codes editor, then you will be able to see and edit the content in codes, see my screenshot field-and-text.JPG
More help:
https://toolset.com/block-item/fields-and-text/
My issue is resolved now. Thank you!