2011-05-16 111 views
1

我試圖用wordpress使用strip_tags()過濾掉所有帖子裏面的所有標籤。我這樣設置:WordPress的PHP回聲問題

<?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 
?> 

這似乎並沒有去掉他們想要的標籤。

+0

你以什麼方式期待? – alex 2011-05-16 05:31:29

回答

1

變化the_content()變爲get_the_content()

the_content()用於直接輸出內容,而get_the_content返回要存儲在變量中的內容以供進一步處理。

$footertext = get_the_content(); 
+0

我可以在循環中使用它嗎? – Thomas 2011-05-16 05:37:03

+0

@Thomas:是的,你可以試試。 – 2011-05-16 05:38:40