简体   繁体   English

WordPress-空P标签

[英]Wordpress - empty p tags

I am getting empty p tags that I cannot remove with jQ, nor can I see them in the source. 我得到的空p标签无法用jQ删除,也无法在源代码中看到它们。 They are being added by a mobile theme and can only be seen with the browser tool. 它们是通过移动主题添加的,只能通过浏览器工具查看。 I dont think jQ is adding them... 我不认为jQ正在添加它们...

http://war-mobile.h2client.com/pillar/residential/?wpmp_switcher=mobile http://war-mobile.h2client.com/pillar/residential/?wpmp_switcher=mobile

Under the "We offer, right under the top white div border. I know how to solve the problem, as I did above, ([raw]) but I am curious why this is happening? 在“我们提供的,就在白色div顶部边框的正下方。我像上面一样知道如何解决问题,但我很好奇为什么会这样?

Add the following to your functions.php file in your theme: 将以下内容添加到主题中的functions.php文件中:

add_filter('the_content', 'remove_empty_p', 20, 1);
function remove_empty_p($content){
$content = force_balance_tags($content);
return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM