WordPressのRSSで配信される本文「description」部分の文字数をコントロールする

wp-includeフォルダ内のfeed.phpの176行目あたりにある

function the_excerpt_rss() {
	$output = get_the_excerpt();
	echo apply_filters('the_excerpt_rss', $output);
}

function the_excerpt_rss() {
	$output = wp_kses(get_the_content(), $allowed_html, $allowed_protocols);
	echo mb_strimwidth(apply_filters('the_excerpt_rss', $output),0, 450,"…");	
}

というように修正。「450」となっているところが文字数で最後の

"…"

が文末に持ってきたい定型文などあれば追加するところです。

カテゴリー: wordpress   作成者: hello パーマリンク

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA