the_content()在div外部显示

乔伊德夫·帕尔

我正在使用以下功能来显示内容。内容显示正确,但在div之外。

<?php
function show_post(){
$query = new WP_Query(array('post_type' => 'circular', 'post_per-page' => -1));

if($query->have_posts()){
    while($query->have_posts()){
        $query->the_post();

        $circular_slider .= '<div class="ca-item ca-item-1"><div class="ca-item-main"><div class="ca-icon"></div><p>';
        $circular_slider .= ''.the_content().'';
        $circular_slider .= '</p></div></div>'; 
    }
}   
wp_reset_postdata();
return  $circular_slider;
}
?>
克劳

the_content直接输出内容–您想使用它get_the_content,因为这将返回内容。

http://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章