プラグインのTinyMCE Advancedを有効にして、記事中に<!--more-->タグを挿入すると、記事一覧ページで</p></p>という構文エラーが発生する場合があります。
◆修正方法
functions.phpへ、以下のコードを追記。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
//--------------------------------------------------------------------------- // 記事の置換 //--------------------------------------------------------------------------- function doReplace(){ add_filter('the_content', 'the_content_replace',1); } function the_content_replace($text){ $patterns = array(); $patterns[0] = '@<p></p>@'; $replacements = array(); $replacements[0] = ''; $text = preg_replace($patterns, $replacements, $text); return $text; } |
archive.phpの
1 2 3 |
<?php the_content(''); ?> |
とあるところへ、
1 2 3 4 |
<?php doReplace(); //本文置換 the_content(''); ?> |
と記載。
以上で、構文エラーは修正出来ます。