投稿文から画像(img)タグのみを削除する。
-
はじめて、質問をさせていただきます。
同じようなトピックがあったら申し訳ありません。親ページに子ページの本文を表示させています。
本文に使われている、htmlタグを削除する方法は分かったのですが、
改行などのコードは、残して表示するにはどうしたらいいでしょうか?<?php if ( $post->post_parent == 0 ) { //子ページの情報を取得 $child_posts = get_posts( 'numberposts=-1&order=ASC&orderby=post_title&post_type=page&post_parent=' . $post->ID ); if ( $child_posts ) { foreach ( $child_posts as $child ) { //子ページのタイトル $c_title = apply_filters( 'the_title', $child->post_title ); //子ページのパーマリンク $c_permalink = apply_filters( 'the_permalink', $child->post_title ); //子ページの本文 $c_content = get_extended( $child->post_content); $c_content = apply_filters('the_content', $c_content['main'] ); //htmlのタグ外し $c_content = strip_tags($c_content); ?>
アドバイスを宜しくお願い致します。
2件の返信を表示中 - 1 - 2件目 (全2件中)
2件の返信を表示中 - 1 - 2件目 (全2件中)
- トピック「投稿文から画像(img)タグのみを削除する。」には新たに返信することはできません。