1

次のコードを使用して、特定の投稿 (この場合は 103) の内容を出力しています。

<?php $post_id = 103; $queried_post = get_post($post_id); echo apply_filters('the_content',$queried_post->post_content); ?>

<p>やなどのすべての html タグを除外して<br>s、テキストのみを表示するにはどうすればよいですか?

ありがとう!

4

1 に答える 1

4

strip_tag(string) 関数を使用して、文字列からすべての html タグを削除します

echo strip_tags(apply_filters('the_content',$queried_post->post_content));
于 2013-06-27T17:12:09.533 に答える