1

我想更改标准帖子类型的格式,但似乎找不到修改格式的位置。这是继承形式 wp-includes 还是什么?

4

1 回答 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]”之间键入内容。[raw] 你的内容 [/raw]

于 2013-03-14T10:02:34.680 回答