0

/wp-includes/post-template.php にある the_content を

function the_content($more_link_text = null, $stripteaser = false) {
    $content = get_the_content($more_link_text, $stripteaser);
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    echo $content;
}

の中へ

function the_content($more_link_text = null, $stripteaser = false) {
    $content = get_the_content($more_link_text, $stripteaser);
    $content = apply_filters('the_content', $content);
    echo $content;
}

wordpress コードに触れずにプラグインでこれを達成するにはどうすればよいですか(コードのアップグレードに互換性を持たせます)。特定の機能を置き換えることができることは知っていますが、これは?

4

2 に答える 2

0

Wordpress には、テーマとプラグインでオーバーライドできるコア関数のリストがあります。それらはプラグ可能な関数と呼ばれます: http://codex.wordpress.org/Pluggable_Functions

the_content()はそのリストにないため、直接交換することはできません。

WordPress コードを編集したくない場合、簡単に編集する方法はありません。唯一のオプションは、関数のローカル コピー (myTheme_the_content()または同様の名前) を作成し、代わりにそれを呼び出すようにテーマ内の参照を変更することです。

于 2013-07-19T15:37:56.093 に答える
0
于 2013-07-19T15:45:32.217 に答える