【问题标题】:Unwanted <p> tags in shortcode output. wpautop filter already removed短代码输出中不需要的 <p> 标签。 wpautop 过滤器已被删除
【发布时间】:2012-08-17 14:07:02
【问题描述】:

我为 Wordpress 编写了一个简单的短代码,它根据特定的内容搜索输出一组内部的另一个。

问题是,我不断收到这个

我的输出中的标签,这使我的代码有点混乱。虽然我可以忍受它,但我不能快乐地生活。

我已经添加了

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

在我的主题的“functions.php”中。但结果是一样的。

简码如下:

$return = "<div class='tarimas-teaser-container'>";
$n = 0;
if ($wp_qry->have_posts()):
    while ($wp_qry->have_posts()): $wp_qry->the_post();
        $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($wp_qry->post->ID), 'thumbnail');
        $return .= "<div class='tarimas-teaser-unit'><h4><a href='{$wp_qry->post->guid}'>{$wp_qry->post->post_title}</a></h4>";
        $return .= "<a href='{$wp_qry->post->guid}'><img src='{$thumb[0]}' width='{$a['ancho_img']}' height='{$a['alto_img']}' class='tarimas-teaser-img' /></a>$div_precio";
        $return .= "</div><!--tt-unit-->";
    endwhile;
endif;
$return .= "</div><!-- ttttt-container -->";

return $return;

我什至在构造的代码上都没有换行符。然而我明白了:

<div class='tarimas-teaser-container'>
<div class='tarimas-teaser-unit'>
<h4><a href='http://www.tarimasterhurne.es/productos/roble-blanco-arena-1199020372/'>Roble Blanco Arena</a></h4>
<p><a href='http://www.tarimasterhurne.es/productos/roble-blanco-arena-1199020372/'><img src='http://www.tarimasterhurne.es/wp-content/uploads/2012/07/1199020372_main-150x150.jpg' width='100' height='100' class='tarimas-teaser-img' /></a>
<div class='precio mini'>10,93</div>
</div>
<p><!--tt-unit-->
<div class='tarimas-teaser-unit'>
<h4><a href='http://www.tarimasterhurne.es/productos/roble-marron-rojo-1199020368/'>Roble Marrón Rojo</a></h4>
<p><a href='http://www.tarimasterhurne.es/productos/roble-marron-rojo-1199020368/'><img src='http://www.tarimasterhurne.es/wp-content/uploads/2012/07/1199020368_main-150x150.jpg' width='100' height='100' class='tarimas-teaser-img' /></a>
<div class='precio mini'>11,03</div>
</div>
<p><!--tt-unit-->
<p><!-- ttttt-container --></p>

这让我发疯。 再说一遍:我已经在 functions.php 中删除了 wp_autofilter。

【问题讨论】:

  • 是的,一些疯狂的插件。我曾经遇到过这个问题。检查每个插件。启用和禁用。
  • 是的.. 很快。显然,“短代码-终极”是本案的罪魁祸首。好吧,至少没用多久。谢谢!
  • 就是这个插件:“shortcodes-ultimate”。通过在其设置页面中禁用“自定义格式”,问题得到解决。 :P

标签: php wordpress wordpress-theming code-formatting


【解决方案1】:

是的,一些疯狂的插件。

检查每个插件...启用和禁用每个插件

【讨论】:

  • 就是这个插件:“shortcodes-ultimate”。通过在其设置页面中禁用“自定义格式”,问题得到解决。 :P
猜你喜欢
  • 2012-11-10
  • 1970-01-01
  • 1970-01-01
  • 2021-03-18
  • 2020-01-31
  • 1970-01-01
  • 2011-03-30
  • 1970-01-01
  • 2013-01-19
相关资源
最近更新 更多