我使用以下代码打印特定帖子的内容(在本例中为 103):
<?php $post_id = 103; $queried_post = get_post($post_id); echo apply_filters('the_content',$queried_post->post_content); ?>
Run Code Online (Sandbox Code Playgroud)
我怎样才能让它排除所有 html 标签,如<p>和<br>s,只显示文本?
谢谢!
使用 strip_tag(string) 函数从字符串中删除所有 html 标签
echo strip_tags(apply_filters('the_content',$queried_post->post_content));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3361 次 |
| 最近记录: |