1) 尝试几个不同的插件,它们可以禁用格式并阻止WP内置的对额外段落和空白的剥离:http://wordpress.org/extend/plugins/search.php?q=formatting&sort=
2) 您可以使用以下命令欺骗WP添加段落分隔符<b> <b/>
在html编辑器中。这是一个不间断的空间<b>
标签。您将无法在可视化编辑器中看到它,因此请将其添加到htnl编辑器中。这很难看,但它不需要完全禁用格式就可以工作。
3) 也可以在函数中执行此操作。php,然后包装不希望格式化的文本<!-- noformat on -->
和<!-- noformat off -->
标签。
function newautop($text)
{
$newtext = "";
$pos = 0;
$tags = array(\'<!-- noformat on -->\', \'<!-- noformat off -->\');
$status = 0;
while (!(($newpos = strpos($text, $tags[$status], $pos)) === FALSE))
{
$sub = substr($text, $pos, $newpos-$pos);
if ($status)
$newtext .= $sub;
else
$newtext .= convert_chars(wptexturize(wpautop($sub))); //Apply both functions (faster)
$pos = $newpos+strlen($tags[$status]);
$status = $status?0:1;
}
$sub = substr($text, $pos, strlen($text)-$pos);
if ($status)
$newtext .= $sub;
else
$newtext .= convert_chars(wptexturize(wpautop($sub))); //Apply both functions (faster)
//To remove the tags
$newtext = str_replace($tags[0], "", $newtext);
$newtext = str_replace($tags[1], "", $newtext);
return $newtext;
}
function newtexturize($text)
{
return $text;
}
function new_convert_chars($text)
{
return $text;
}
remove_filter(\'the_content\', \'wpautop\');
add_filter(\'the_content\', \'newautop\');
remove_filter(\'the_content\', \'wptexturize\');
add_filter(\'the_content\', \'newtexturize\');
remove_filter(\'the_content\', \'convert_chars\');
add_filter(\'the_content\', \'new_convert_chars\');