あなたのようadd_action(loop_start,smtg)
またはadd_action(loop_end,smtg)
またはapply_filters('the_content', $content);
を使用することができます。
<?php
$content = apply_filters('the_content', $content);
$content = do_your_stuff;
?>
それは本当にあなたが何をしたいかに依存して... は、ここに詳細を参照してください。http://codex.wordpress.org/Plugin_API/Action_Reference
すべて」あなたが本当にそうしたいと思えば - あなたはいつもREGEXをconに使うことができます10トン...
または別の方法 - 例えば:
function k99_replace_content(){
//get the content
$content= get_the_content(); //get the content as a variable
// where we want to cut ??
// by length ??
$full_length= STRLEN($content);
$cutting_point = ($full_length/ 2);
// regex ??
//do regex stuff here ..
// clip off the first part - if we choose by length
$firstpart = SUBSTR($content, 0, $cutting_point);
// ending '<br>'
$end_point = STRRPOS($firstpart, '<br>');
// add whatever
return SUBSTR($content, 0, $end_point) . "<div>put whatever you want>/div>" . SUBSTR($content, $end_point);
}
ADD_FILTER( 'the_content'、 'k99_replace_content');
または最後のオプション、@IanBは、これらの方法のいずれかと一緒に提案したものを使用 - とフィルターを通して含ま..自分の質問に答える
私は、これは確かに働くだろう知っている...しかし、私はテーマファイルを編集する必要はありません...マルチサイトのために、私はすべてのテーマのインストールのためにこれを行う必要があります...これはなぜ私はプラグインを開発しようとしていた...私はテーマの独立したソリューションが欲しい... –