So ive been trying to learn a little PHP lately. There are a few plugins for adsense in WP, but still you must place markup in each post you wish the adsense to appear in. The ones ive tryed anyway. Heres a solution.
You can place this in any post or after any post you wish. you can also place multiple ads using different variations. (if you want an ad after the first post and within the content of the first post you can do that by setting up two different variables.
Set up a new .php file and save it under the theme you are using (eg; ads_1.php )
Now in the file create a container <div id="ads-1"> </div>, now place Google, yahoo or whatever ad code inside div and style within your style sheet.
In your index.php file you will want to place this or something similar after the head tag.
<?php $GoogleAds = true; ?>
now find in the index file where you would like to place your ad, say in this case between the first and second posts, after the closing div for the post and post meta data place the following....
<?php If ($GoogleAds) { ?>
<?php include ('ads-1.php'); ?> // or you can just place ad code instead of php file
<?php $GoogleAds = False;} ?>
and there you have it, an ad between your first and second post that will only be displayed between the first an second posts.
Like I mentioned above you can set up another file ads-2.php and set the variable, call the file in your first post, style it and work it right into content. No need to place any ad code in your posts.
I got the basis for this simple code from WP.org, but played around with it a bit. I am going to try a few more things woth it that im sure will work, like placing all php within the ad.php file anf just adding a <? include ('ad1.php'); ?> in the area that id like to place the ad.
I posted this because Ive seen allot of talk about the MMV templates and adding adsense to the first post or after the first post around. This code is your ticket.
You can place this in any post or after any post you wish. you can also place multiple ads using different variations. (if you want an ad after the first post and within the content of the first post you can do that by setting up two different variables.
Set up a new .php file and save it under the theme you are using (eg; ads_1.php )
Now in the file create a container <div id="ads-1"> </div>, now place Google, yahoo or whatever ad code inside div and style within your style sheet.
In your index.php file you will want to place this or something similar after the head tag.
<?php $GoogleAds = true; ?>
now find in the index file where you would like to place your ad, say in this case between the first and second posts, after the closing div for the post and post meta data place the following....
<?php If ($GoogleAds) { ?>
<?php include ('ads-1.php'); ?> // or you can just place ad code instead of php file
<?php $GoogleAds = False;} ?>
and there you have it, an ad between your first and second post that will only be displayed between the first an second posts.
Like I mentioned above you can set up another file ads-2.php and set the variable, call the file in your first post, style it and work it right into content. No need to place any ad code in your posts.
I got the basis for this simple code from WP.org, but played around with it a bit. I am going to try a few more things woth it that im sure will work, like placing all php within the ad.php file anf just adding a <? include ('ad1.php'); ?> in the area that id like to place the ad.
I posted this because Ive seen allot of talk about the MMV templates and adding adsense to the first post or after the first post around. This code is your ticket.