个性化阅读
专注于IT技术分析

短代码输出中不需要的p标签。 wpautop过滤器已删除

我为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。


#1


是的, 一些疯狂的插件。

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

赞(0)
未经允许不得转载:srcmini » 短代码输出中不需要的p标签。 wpautop过滤器已删除

评论 抢沙发

评论前必须登录!