我想用get_the_excerpt()帶來一些結果。如何從內容結果wordpress中刪除標籤?
在某些方面,我有這樣的結果。我想刪除這些標籤,結果
這是文字,我得到:
板球世界盃得主的板球世界盃冠軍:一個信息圖形由團隊AsiaBet.org嵌入板球世界盃獲勝者在您的網站:複製並粘貼下面的代碼https://www.asiabet.org/wp-content/uploads/2015/02/CWC_ALL1.jpg「alt =」板球世界盃獲勝者 - Asiabet.org「> https: //www.asiabet.org/cricket-world-cup-infographic/"> Asiabet.org 2015年板球世界盃獲勝者僅意味着一件事 - 國際商會板球世界...
我的代碼
$result = get_the_excerpt();
if ($result != '') {
echo $result . '...'.'<br><br>';
} else {
$post_id = get_the_ID();
echo get_post_field('description', $post_id);
} ?>
use:$ result = strip_tags(get_the_excerpt()); –
'strip_tags()'? http://php.net/manual/en/function.strip-tags.php – JustBaron
這是我的第一個行爲,但不知何故它沒有工作 –