dtw52353 2011-05-16 05:29
浏览 47
已采纳

Wordpress php回声问题

Im trying to filter out all of the tags inside a post in wordpress using strip_tags(). I set it up like this:

<?php
// The Query
echo date ("Y");
query_posts( 'p=10' );
// The Loop
while ( have_posts() ) : the_post();
$footertext = the_content(); 
echo strip_tags($footertext);
endwhile;
// Reset Query
?>

This doesn't seem to strip out the tags they way I expected.

  • 写回答

1条回答 默认 最新

  • dquh37673 2011-05-16 05:34
    关注

    Change the_content() to get_the_content().

    the_content() is used to directly output the contents whereas get_the_content returns contents to be stored in variable for further processing.

    $footertext = get_the_content(); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?