Skip Navigation

[Resolved] Filtering squeezed when there is only 1 item

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

Problem:

A user reported that the bootstrap grid layout in the view doesn't show correctly if there is only one result

Solution:

Suggested to check that all the relevant div tags were properly included and closed, with an example HTML

Relevant Documentation:

n/a

This support ticket is created 2 years, 10 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
- 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 gille 2 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#2330025

Hi, I got a filtering of woocommerce products in a view. It all works but when there is only 1 item the column and filter is squeezed.

Can you help me?

Site: hidden link
-> problem when clicking on "Gifts"

Thanks!

#2330131

Hi,

Thank you for contacting us and I'd be happy to assist.

From looking into the source code of the page, it seems some closing div tag is for the grid layout is not placed correctly in the view's "Loop Editor".

Here is an example of the correct structure of the grid layout, with 3 columns:


[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop wrap="3" pad="true">
		[wpv-item index=1]
		<div class="row ">
			<div class="col-md-4">
				// Content
			</div>
		[wpv-item index=other]
			<div class="col-md-4">
				// Content
			</div>
		[wpv-item index=3]
			<div class="col-md-4">
				// Content
			</div>
		</div>
		[wpv-item index=pad]
			<div class="col-md-4"></div>
		[wpv-item index=pad-last]
			<div class="col-md-4"></div>
		</div>
	</wpv-loop>
	<!-- 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]

Note: You'll replace "// Content" with the actual content for the individual loop item.

In case the issue persists, please share the actual content that you have in the view's loop editor.

regards,
Waqar

#2330189
Schermafbeelding 2022-03-30 om 15.08.19.png
Schermafbeelding 2022-03-30 om 15.05.13.png

Hi Waqar, thanks for the feedback.

Seems not to help if I replace the code with the basic structure. There is indeed a </div> too much but it has always been that way in Toolset views when generating a bootstrap loop. Even if I remove the div, it's still like that.

Here the code now (and also the in attatch some screenshots):

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop wrap="3" pad="true">
[wpv-item index=1]
<div class="row ">
<div class="col-md-4">
[wpv-post-body view_template="loop-item-in-productgrid"]
</div>
[wpv-item index=other]
<div class="col-md-4">
[wpv-post-body view_template="loop-item-in-productgrid"]
</div>
[wpv-item index=3]
<div class="col-md-4">
[wpv-post-body view_template="loop-item-in-productgrid"]
</div>
</div>
[wpv-item index=pad]
<div class="col-md-4"></div>
[wpv-item index=pad-last]
<div class="col-md-4"></div>
</div>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]Geen producten gevonden[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

#2330701

Thanks for writing back.

I've tested the exact code that you've shared and couldn't reproduce the same behavior on my test website.

Can you please share temporary admin login details, so that I can see how this view is set up in the admin area?

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

#2330751

My issue is resolved now. Thank you!