theme/functions.php
<?php //複数改行を有効にするスクリプト /* Script Name: Force Break Author: Tenman Author URI: http://www.tenman.info/ Version: 0.1 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html/
add_filter('the_content','force_break_before',3 ); add_filter('the_content','force_break_after',99999 ); function force_break_before($contents){ if(preg_match('!\[nobita\]!',$contents) ){ return str_replace( PHP_EOL,'<br class="space" />'.PHP_EOL,$contents ); } return $contents; } function force_break_after($contents){ if(preg_match('!\[nobita\]!',$contents) ){ return str_replace(array( '<br />','<br>','[nobita]'),array( '', '', '' ), $contents ); } return $contents; } ?>
style.css
hr + br.space, body + br.space, div + br.space, dl + br.space, dt + br.space, dd + br.space, ul + br.space, ol + br.space, li + br.space, h1 + br.space, h2 + br.space, h3 + br.space, h4 + br.space, h5 + br.space, h6 + br.space, pre + br.space, code + br.space, form + br.space, fieldset + br.space, legend + br.space, input + br.space, button + br.space, textarea + br.space, blockquote + br.space, table br.space, th + br.space, tbody + br.space, thead + br.space, tfoot + br.space, tr + br.space, td + br.space{ display:none; }
http://d.hatena.ne.jp/tenman/20121004/p1(@source)