まずサブテーマを作っておく。
元のテーマのサーバーへ行き、content.php をコピーしてサブテーマに同じファイルを作り保存。
次に、サブテーマの content.php の
the_excerpt()
を探して
the_content()
に書き換えて保存。
これでできてるはず。
注意点は、属性も元のテーマに揃えておくこと。
逆に要約表示させる場合は以下をfunctions.phpに追加。その時、末尾に木異才される「…」を「read more」に変更するタグも追加したいので、それも記載。
// "read more" 追加
function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '">[...read more]</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
function custom_excerpt_length( $length ) {
return 90; //変更する文字数
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
- Log in to post comments
カテゴリー