Add the adsense code to your theme’s single.php file only.
yes, but how to display after the more tag ?
in single.php, instead of the_content();
try to use:
$story = get_the_content();
$story = explode('<span id="more',$story);
$first_part_of_story = $story[0];
$second_part_of_story = $story[1];
$first_part_of_story = apply_filters('the_content', $first_part_of_story);
echo $first_part_of_story;
if ($second_part_of_story) {
echo 'here adsense code';
$second_part_of_story = explode('</span>',$second_part_of_story);
$second_part_of_story = apply_filters('the_content', $second_part_of_story[1]);
echo $second_part_of_story;
} ;
thank’s alchymyth it work
Hey!
I’m using this code on one of my websites, but I’m having a problem. When I use plugins that adds something to the bottom of my post, it shows in the bottom of the post, but also after the more tag (in the middle of the post).
Is there someway to modify this code to prevent that from happening?
Thanks!
// Jens.
try this new approach – without the need to edit single.php – i.e. leave the_content()
as it is:
it uses a filter function (http://codex.wordpress.org/Plugin_API/Filter_Reference) and pops the ad code right into the more span in single post:
http://wordpress.pastebin.com/vGuWG7Hp
Thanks a lot, that’s perfect!