wordpressには記事の抜粋テキストを任意に設定できるようになっている。
出力の際にはget_the_excerpt()関数又はthe_excerpt()で出力できるが、内部で改行を行うことが出来ない。
brタグを直接抜粋の欄に入力すれば機能するが、そういったことも面倒くさい場合はget_the_excerpt()関数の改行をbrタグに変換する関数を追加する。
functions.php
function get_the_excerpt_with_br($post) {
global $post;
$excerpt_with_br = get_the_excerpt($post->ID);
return nl2br($excerpt_with_br);
}