標準の投稿タイプのフォーマットを変更したいのですが、フォーマットを変更する場所が見つかりません。これは wp-includes などから継承されたものですか?
1 に答える
0
このショートコードを使用してみてください:
(このコードを functions.php の最後に貼り付けます)
function my_formatter($content)
{
$new_content = '';
$pattern_full = '{(\[raw\].*?\[/raw\])}is';
$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($pieces as $piece) {
if (preg_match($pattern_contents, $piece, $matches)) {
$new_content .= $matches[1];
} else {
$new_content .= wptexturize(wpautop($piece));
}
}
return $new_content;
}
使用法: 管理パネルで、投稿に移動し、「[raw]」と「[/raw]」の間にコンテンツを入力します。[生]あなたのコンテンツ[/生]
于 2013-03-14T10:02:34.680 に答える