Hi,
I am using the Conditional Block to show custom fields when they are not empty.
It works with any field except when I use "Post Content (Body)".
hidden link
What I am doing wrong?
Thanks
Best
Hello and thank you for contacting the Toolset support.
I run a test on a clean installation and I was able to reproduce the issue. I will escalate this to our 2nd Tier for a second evaluation before involving the developers.
In the meantime, I hope the following workaround will be a viable solution for you:
1. Add the following custom code to Toolset->Settings->Custom Code.
<?php
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
function ts_is_content_empty(){
global $post;
if (strlen( $post->post_content ) == 0){
return 1;
} else {
return 0;
}
}
2. Register the "ts_is_content_empty" function for use in conditions in Toolset->Settings->Front-end Content->Functions inside conditional evaluations. Check this article https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-custom-functions-in-conditions/
3. Update your conditional block to use this function instead of the builtin "Empty" function. Check this screenshot hidden link
Then update your block accordingly.
I run my test on an online installation, you can check it closely using the following URL hidden link