Woocommerce购物车添加了额外的< p>标签 [英] Woocommerce cart adding extra <p> tags

查看:241
本文介绍了Woocommerce购物车添加了额外的< p>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用woocommerce设置了一个演示商店。除了购物车页面在使用短代码[woocommerce_cart]时在表单中添加了几个空的段落标签外,一切似乎都很好。

I'm setting up a demo shop using woocommerce. Everything seems fine except the cart page is adding several empty paragraph tags within the form when using the shortcode "[woocommerce_cart]".

从短码生成的代码看起来像这样在检查时的HTML:

The code generated from the shortcode looks like this in HTML when inspected:

<form method="post" action="http://organicthemes.com/demo/photographer/shopping-cart/">
<p></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<table class="shop_table cart" cellspacing="0">
</form>

您可以在此处查看页面, http://organicthemes.com/demo/photographer/shopping-cart/

You can view the page here, http://organicthemes.com/demo/photographer/shopping-cart/

我只能假设WordPress autop正在拧紧这个。我找不到任何原因的主题或插件引起这个问题。任何帮助将不胜感激。

I can only assume WordPress autop is screwing this up. I can't find any reason for the theme or plugin to be causing this issue. Any help would be appreciated.

目前,我已经准确定位段落标签,因为我可以使用CSS,但它是一个马虎的修复。

Currently, I've targeted the paragraph tags as accurately as I can using CSS, but it's a sloppy fix.

推荐答案

我没有看到在你链接的示例页面中的空段落标签,但我肯定可以看到在我的自己目前的Woocommerce项目。我已经注意到问题出现在购物车窗体(form-shipping.php和form-b​​illing.php),但我知道我也看到了出现在其他部分/面的商店的问题(recent_products短码,一)。看起来wp_autop()正在应用于模板文件自身的空格。

I'm not seeing the empty paragraph tags in the example page you linked to, but I can certainly vouch for seeing plenty of empty paragraph tags in my own current Woocommerce project. I've definitely noticed the issue occur in the cart forms (form-shipping.php and form-billing.php), but I know I've also seen the issue arise in other sections/facets of the shop (recent_products shortcode, for one). It seems like wp_autop() is getting applied to the whitespace in the template files themselves.

这也是一种不必要的修复,但从模板文件中删除空格似乎删除空的段落标签。你不必最小化整个文件,虽然。到目前为止,我可以告诉,似乎该问题是由空白的空白段标签的父元素的关闭标签之前的空格触发的。

It's also kind of an undesirable fix, but removing whitespace from the template files seems to remove the empty paragraph tags. You don't have to minimize whole files, though. So far that I can tell, it seems the issue is triggered by whitespace before the closing tags of parent elements of the empty paragraph tags. But not blank lines... It's tabs or normal spaces that seem to be the catalysts.

尝试删除空段落的父元素的结束标签之前的任何制表符或正常空格。

Try removing any tabs or normal spaces that are present before the closing tags of the parent elements of the empty paragraphs.

这篇关于Woocommerce购物车添加了额外的&lt; p&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆