Hey there,
I have a content template where I'm displaying a custom type field 'short-description' which is WYSIWYG field. I initially tried:
{!{types field='short-description'}!}{!{/types}!}
Which didn't do what I needed as it stripped all the styling, line breaks... so I used:
{!{types field='short-description' suppress_filters='true'}!}{!{/types}!}
Which didn't make a difference... so I tested both variations, one under the other:
{!{types field='short-description'}!}{!{/types}!}
{!{types field='short-description' suppress_filters='true'}!}{!{/types}!}
In that configuration, the second one, with the filters did what it was expecting to do and kept the styling.
The problem (and bug I believe) is that it only works in that configuration, if I delete the first line: {!{types field='short-description'}!}{!{/types}!}, the second one: {!{types field='short-description' suppress_filters='true'}!}{!{/types}!} doesn't work anymore...
Any idea?
Thanks,
Hi Xavier,
Thank you for contacting us and I'll be happy to assist.
I was able to reproduce this behavior on my test website with a WYSIWYG field.
Appreciate you brought this forward and I'll pass on these findings to the concerned team for further testing and review. I'll also keep you updated with the progress.
As a quick fix, you can add the following code for custom shortcode in active theme's "functions.php" file:
add_shortcode( 'show-filtered-content', 'show_filtered_content_func');
function show_filtered_content_func($atts){
$a = shortcode_atts( array(
'field' => ''
), $atts );
if( !empty($a['field']) )
{
$content = apply_filters( 'the_content', do_shortcode( '[types field="'.$a['field'].'" suppress_filters="true"][/types]' ) );
return $content;
}
}
To show the content in your content template, you can use it like this:
[show-filtered-content field="short-description"]
I hope this helps and please let me know how it goes.
regards,
Waqar
Hi Xavier,
Just wanted to update you that the public-facing erratum for the issue is accessible at:
https://toolset.com/errata/paragraph-tag-is-stripped-in-wysiwyg-loop-items-and-page-builders-generated-content/
As mentioned in the erratum, a simpler workaround is to wrap the WYSIWYG field's shortcode inside a builtin "wpv-autop" shortcode:
{!{wpv-autop}!} {!{types field='short-description'}!}{!{/types}!} {!{/wpv-autop}!}
regards,
Waqar
My issue is resolved now. Thank you!
Hi Xavier,
I just wanted to update that since a workaround is available to deal with this issue, it will not be addressed in any future Toolset releases.
( ref: https://toolset.com/errata/paragraph-tag-is-stripped-in-wysiwyg-loop-items-and-page-builders-generated-content/ )
regards,
Waqar