Skip Navigation

[Resolved] Inconsistent behavior displaying custom field

This support ticket is created 6 years 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Waqar 4 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#1177779

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,

#1178930

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

#1180016

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

#1180405

My issue is resolved now. Thank you!

#1580417

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