0

私はWordPressでmy_custom_function後に追加しようとしていますthe_content

add_filter ('the_content', 'my_custom_function');
add_action ('the_content', 'my_custom_function'); // I tried both

私のmy_custom_function機能はこんな感じです

function my_custom_function($content) {
    if(is_single()) {
        $content .= "this is custom function content";
        $content .= my_another_custom_function();
        $content .= "this is custom function content";
    }

return $content;
}

私の問題は、このコードがmy_another_custom_function() 前に 追加されていることですが、コンテンツのthe_contentに追加したいです。

コードに示されている他の2行$content .= "this is custom function content";はテスト用であり、これらは後に表示されます the_content

誰かがそれを修正する方法と私が間違っていることについて私に何か考えを教えてもらえますか...

4

1 に答える 1

1

最も考えられる理由は、 my_another_custom_function() が単に出力を返すのではなくエコーすることです。

于 2012-07-01T10:02:57.610 に答える