WordPress: excerptの文字数を調整

抜粋の文字数を調整する方法。

複数調整する場合は、fuction内で条件分岐。

 

// ホームだけ抜粋の本文を半分に
function new_excerpt_mblength($length) {
     if (is_front_page()) {
     return 55;
     }else {
     return 110;
     }
}

add_filter('excerpt_mblength', 'new_excerpt_mblength');