タグ別アーカイブページが全文表示になってしまいます
-
自作テーマで タグ別アーカイブページをつくりました。
トップページの投稿一覧は抜粋表示なのですがタグ別アーカイブページではなぜか全文表示になってしまいます。
抜粋は以下のコードをfunctions.phpに追加しました。function my_excerpt_more($post) {
return ‘ ID) . ‘” class=”link”>’ . ‘続きを読む’ . ‘‘;
}function my_trim_all_excerpt( $text = ” , $cut = 0 ) {
$raw_excerpt = $text;
if ( ” == $text ) {
$text = get_the_content(”);
$text = strip_shortcodes( $text );
$text = apply_filters(‘the_content’, $text);
$text = str_replace(‘]]>’, ‘]]>’, $text);
$text = strip_tags($text);}
$excerpt_mblength = apply_filters(‘excerpt_mblength’, $cut );
$excerpt_more = my_excerpt_more( $post );
$text = wp_trim_words( $text, $excerpt_mblength, $excerpt_more );return apply_filters(‘wp_trim_excerpt’, $text, $raw_excerpt);
}remove_filter(‘get_the_excerpt’, ‘wp_trim_excerpt’);
add_filter(‘get_the_excerpt’, ‘my_trim_all_excerpt’ );tag.phpをつくってindex.phpとまったく同じにしてみましたが全文表示でした。
タグ別ページも抜粋表示にしたいのですがどうすればよいでしょうか。
- トピック「タグ別アーカイブページが全文表示になってしまいます」には新たに返信することはできません。