Skip Navigation

[Resolved] Extra paragraphs being added when Views are displayed and edited in blocks

This thread is resolved. Here is a description of the problem and solution.

Problem: Extra paragraph tags and line breaks are added to the results of a View

LEGACY VIEWS Solution: Add the suppress_filters attribute to the Content Template shortcodes in the View's loop editor area.

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153372

This support ticket is created 2 years, 11 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by nickH-5 2 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#2022369

I am not sure if this is a bug or something which has arisen when I have started using blocks. I have a number of views using the same set of content templates which appear to include additional unwanted <p> </p> tags which break the view. You can see the kind of thing at hidden link and in the image uploaded. This does not happen in the very first item shown but in all subsequent items

Here is the view loop:

[wpv-layout-start]
	[wpv-items-found]
<br>
	<!-- wpv-loop-start -->
	<wpv-loop wrap="3" pad="true">
		[wpv-item index=1]
		<div class="row" style="margin:5px;">
			<div class="col-sm-4">[wpv-post-body view_template="upright-image-title-long-more-with-type"]</div>
		[wpv-item index=other]
			<div class="col-sm-4">[wpv-post-body view_template="upright-image-title-long-more-with-type"]</div>
		[wpv-item index=3]
			<div class="col-sm-4">[wpv-post-body view_template="upright-image-title-long-more-with-type"]</div>
		 </div>
		[wpv-item index=pad]
			<div class="col-sm-4"></div>
		[wpv-item index=pad-last]
			<div class="col-sm-4"></div>
         
		</wpv-loop>
<br>
Page : [wpv-pager-current-page][wpv-pager-nav-links output="bootstrap" links_type="dots"] <div class="form-inline">
	<div class="form-group">
		<label>[wpml-string context="wpv-views"]Go to page[/wpml-string]</label>
		[wpv-pager-nav-dropdown output="bootstrap"]
	</div>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

and here is the relevant template:

<div class="no-podcast">
<a href="[wpv-post-url]">
<div class="row no-gutter">
<div class="image" style="background-color:grey;">
<div class="constant-100pc-300">
[wpv-conditional if="( NOT(empty($(_thumbnail_id))) )"][wpv-post-featured-image size="small"][/wpv-conditional]
[wpv-conditional if="( (empty($(_thumbnail_id))) )"]<img src="hidden link">[/wpv-conditional]</div>
<centred-overlay>
[wpv-conditional if="( '[wpv-post-type]' eq 'audio-clip' )"]<i class="fa fa-play-circle" style="font-size:300%; color:rgba(255,255,255,0.63)">[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-type]' eq 'podcast' )"]<i class="fa fa-play-circle" style="font-size:300%; color:rgba(255,255,255,0.63)">[/wpv-conditional]
</centred-overlay>
</div>
</div>

<div class="row no-gutter">
<div class="text-box" style="height:250px; overflow:hidden;">
<span class= "type-header">
<font color="grey">
[wpv-conditional if="( '[wpv-post-type]' eq 'programme-promotion' )"]

[wpv-conditional if="( $(wpcf-date-of-broadcast) gt 'NOW()' )"]

[wpv-conditional if="( ($(wpcf-date-of-broadcast)-86400) lt 'TODAY()' )"]
COMING UP AT [types field='date-of-broadcast' style='text' format='g:i a'][/types] :
[/wpv-conditional]
[wpv-conditional if="( ($(wpcf-date-of-broadcast)-86400) gte 'TODAY()' )"]
[types field='date-of-broadcast' style='text' format='l'][/types] AT [types field='date-of-broadcast' style='text' format='g:i a'][/types] :
[/wpv-conditional]
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-date-of-broadcast) lt 'NOW()' )"]

LISTEN AGAIN :

[/wpv-conditional]

[/wpv-conditional]

[wpv-conditional if="( '[wpv-post-type]' ne 'programme-promotion' )"]

[wpv-post-type show="single"] :

[/wpv-conditional]
</font>
</span>

<span class="title-header">
[trim length="60"][wpv-post-title output='sanitize'][/trim]
</span>

<font color="black">[wpv-post-excerpt length="200" count="character" more="..."]</font>
</div>
<div class="text-box" style="height:20px; overflow:hidden;">
<font style="color:black; font-size:0.7em">
[wpv-post-body view_template="sponsor-relationship"]
</font>
</div>
</div>
</a>
<div class="text-box" style="height:20px; overflow:hidden;">
<a href="[wpv-post-url]" style="position:absolute; bottom:5px; right:30px"><i class="fa fa-circle" style="color:#ED1D24;text-align:right;"><font style="color:#2F2E7C;font-weight:bold; text-transform:uppercase;"> MORE</font></a>
</div>
</div>

#2022373
view issue.PNG

Adding the screenshot of hidden link

#2022527

Hi, the first thing to try is to disable 3rd-party filters on the View loop template shortcodes like so:

[wpv-post-body view_template="upright-image-title-long-more-with-type" suppress_filters="true"]

Add that suppress_filters="true" to the 3 content template shortcodes in the View's loop editor. That may be enough to prevent these extra paragraph tags from being inserted in the View's loop.
Reference: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body

You should also investigate the HTML markup errors shown when validating this page, since invalid markup can cause browser rendering issues:
https://validator.w3.org/nu/?doc=http%3A%2F%2Fradioverulam.com%2Four-shows%2F

I see several issues there that should be addressed, like the Contact Us link being malformatted in the secondary menu, and other invalid nesting issues.

If suppressing filters does not solve the problem, I'll need to take a closer look.

#2025215

Great help. That works.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.