Skip Navigation

[Resolved] when there’s only 1 item in a page, the page breaks

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

Problem: I have a Bootstrap grid View that appears to be working correctly when more than one result is displayed, but if only one result is displayed the grid is broken. Columns are nested inside other columns that should be siblings.

Solution: Check for missing closing tags. Simplify the loop output to isolate any potential markup problems. These could be in a nested View, or in the contents of a field being displayed in the View, or a template, for example.

This support ticket is created 6 years, 5 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 4 replies, has 2 voices.

Last updated by Ido Angel 6 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1069252
Untitled-1.jpg

hey,

take a look at a page with many items:

hidden link

as opposed to a page with a single item:

hidden link

for some reason, the single item page is messing up html and places a col-sm-4 inside a col-sm-4, as seen in the screenshot attached.

#1069429

This usually indicates a missing closing tag or other markup issue in the Loop of this View. Can you please copy + paste the code from the Loop Editor for me to review? If any Content Template is used in this View, please copy + paste the code from that template as well.

#1069517

hey Christian!

well, that would have been right, but if there's more than 1 product it doesn't happen and the loop is fine.

Anyway, here's the html:

<div class="owl-item" style="width: 300px;">
  <div class="vgw-item">
    <div class="vgw-item-i hidden-desc effect-3">
      <div class="product-image">
        <img alt="[wpv-post-title]" src="[wpv-post-featured-image size='full' output='url']" class="primary_image lazy" style="display: block;">
        <span class="second">
          [wpv-conditional if="( $(wpcf-second-image) ne '' )"]<img alt="[wpv-post-title]" src="[types field='second-image' size='full' url='true'][/types]" class="secondary_image lazy" style="display: block;">[/wpv-conditional]
        </span>
        <div class="labels">
          [wpv-conditional if="( '[wpv-post-date format='U']' gt 'MONTHS_FROM_NOW(-1)' )"]<span class="new"><img src="<em><u>hidden link</u></em>" width="56" height="25" class="size-full" /></span>[/wpv-conditional]
          [wpv-conditional if="( woo_product_on_sale() eq '1' )"]<span class="sale"><img src="<em><u>hidden link</u></em>" width="56" height="25" class="size-full" /></span>[/wpv-conditional]
          [wpv-conditional if="( $(wpcf-notkosher) eq '1' )"]<span class="not-kosher"><img src="<em><u>hidden link</u></em>" width="56" height="25" class="size-full" /></span>[/wpv-conditional]
        </div><!-- /.labels -->
        <div class="popupido">
          <!-- Button trigger modal -->
          <a href="#[wpv-post-id]" data-toggle="modal"><img src="<em><u>hidden link</u></em>"></a>
          <!-- Modal -->
          <div id="[wpv-post-id]" class="modal fade" tabindex="-1">
            <div class="modal-dialog modal-lg">
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" data-dismiss="modal" class="iziModal-button iziModal-button-close close">×</button>
                  <h4 class="modal-title">[wpv-post-title]</h4>
                  <img src="<em><u>hidden link</u></em>">
                </div><!-- /.modal-header -->
                <div class="modal-body">
                  <div class="insidetop">
                    <div class="innerright">
                      <div class="idoimg">
                        <img src="[wpv-post-featured-image size='woocommerce_thumbnail' output='url']" class="firstido">
                        <span class="secondido">
                          [wpv-conditional if="( $(wpcf-second-image) ne '' )"]<img src="[types field='second-image' size='full' url='true'][/types]">[/wpv-conditional]</span>
                      </div><!-- /.idoimg -->
                    </div><!-- /.innerright -->
                    <div class="innerleft">
                      <h3 class="innertitle">[wpv-post-title]</h3>
                        [wpv-conditional if="( '[wpv-post-excerpt]' ne '' )"]<strong>[wpv-post-excerpt]</strong>[/wpv-conditional]
                        [wpv-post-body view_template="None"]
                      <div class="ingredients">
                        [wpv-conditional if="( $(wpcf-calories) ne '' ) AND ( $(wpcf-carbohydrates) ne '' ) AND ( $(wpcf-fat) ne '' ) AND ( $(wpcf-fiber) ne '' ) AND ( $(wpcf-protein) ne '' ) AND ( $(wpcf-sugars) ne '' ) AND ( $(wpcf-saturated-fat) ne '' ) AND ( $(wpcf-cholesterol) ne '' ) AND ( $(wpcf-sodium) ne '' )"]<strong>מרכיבים תזונתיים ל-100 גרם:</strong>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-calories) ne '' )"]<p>קלוריות: [types field='calories' output='raw'][/types]</p>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-protein) ne '' )"]<p>חלבונים: [types field='protein' output='raw'][/types]</p>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-fat) ne '' )"]<p>שומנים: [types field='fat' output='raw'][/types]</p>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-sugars) ne '' )"]<p>סוכרים: [types field='sugars' output='raw'][/types]</p>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-carbohydrates) ne '' )"]<p>פחמימות: [types field='carbohydrates' output='raw'][/types]</p>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-fiber) ne '' )"]<p>סיבים תזונתיים: [types field='fiber' output='raw'][/types]</p>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-saturated-fat) ne '' )"]<p>שומן רווי: [types field='saturated-fat'][/types]</p>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-cholesterol) ne '' )"]<p>כולסטרול: [types field='cholesterol'][/types]</p>[/wpv-conditional]
                        [wpv-conditional if="( $(wpcf-sodium) ne '' )"]<p>סודיום: [types field='sodium'][/types]</p>[/wpv-conditional]    
                        [wpv-conditional if="( $(wpcf-calcium) ne '' )"]<p>סידן: [types field='calcium'][/types]</p>[/wpv-conditional]
                      </div><!-- /.ingredients -->
                    </div><!-- /.innerleft -->
                  </div><!-- /.insidetop -->
                  <div class="relatedproducts">
                    <h4>מוצרים רלוונטיים נוספים:</h4>
                    [wpv-view name="related"]
                  </div><!-- /.relatedproducts -->
                </div><!-- /.modal-body -->
              </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
          </div><!-- /.modal -->
        </div><!-- /.popupido -->
      </div><!-- /.productimage -->
      <div class="productdetails">
        <p class="ptitle" style="text-align: center; margin-bottom: 10px;">[wpv-post-title]</p>
        <h3 class="theprice">[wpv-woo-product-price]</h3>
        [wpv-woo-buy-or-select add_to_cart_text="." show_quantity_in_button="yes" show_variation_options="yes"]
      </div><!-- /.productdetails -->
    </div><!-- /.vgw-item-i -->
  </div><!-- /.vgw-item -->
</div><!-- /.owl-item -->

And here's the loop editor:

[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-sm-4">[wpv-post-body view_template="Loop item in Product categories, Product tags"]</div>
		[wpv-item index=other]
			<div class="col-sm-4">[wpv-post-body view_template="Loop item in Product categories, Product tags"]</div>
		[wpv-item index=3]
			<div class="col-sm-4">[wpv-post-body view_template="Loop item in Product categories, Product tags"]</div>
		</div>
		[wpv-item index=pad]
			<div class="col-sm-4"></div>
		[wpv-item index=pad-last]
			<div class="col-sm-4"></div>
		</div>	
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]לא נמצאו מוצרים[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Thanks!

#1069543

Okay lots of content in this loop template including nested Views, so you must simplify it for testing. Copy the current markup and save it somewhere, then delete everything but the wrapper div and post title like this:

<div class="owl-item" style="width: 300px;">
  [wpv-post-title]
</div><!-- /.owl-item -->

Test again. Are the col-sm-4 divs still nested incorrectly for a single post? I'm betting no.

If not, you can assume something is wrong in the template code, or in the nested View output, or you're displaying a custom field value that has unterminated HTML tags. Any of those issues could break the main loop structure. Begin replacing code from the original loop template piece by piece to isolate the problem. Let me know what you find out.

#1069556

thx, got it. it wasn't in this view, in was in the nested view:

[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-sm-4">[wpv-post-body view_template="loop-item-in-sale"]</div>
		[wpv-item index=other]
			<div class="col-sm-4">[wpv-post-body view_template="loop-item-in-sale"]</div>
		[wpv-item index=3]
			<div class="col-sm-4">[wpv-post-body view_template="loop-item-in-sale"]</div>
		</div>
		[wpv-item index=pad]
			<div class="col-sm-4"></div>
		[wpv-item index=pad-last]
			<div class="col-sm-4"></div>
      </div> <!-- THIS CLOSING TAG WAS MISSING -->
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]אין מוצרים במבצע[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

there was a missing </div> closing tag before the </wpv-loop> closing tag.

thanks!