Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   How do I insert an Adsense ad after the first post on the page only? (http://forum.bytesforall.com/showthread.php?t=386)

jonco Feb 14, 2009 08:09 PM

How do I insert an Adsense ad after the first post on the page only?
 
I want to put an Adsense ad after the first post (only) on a page. How, and where can I do that?
Thanks for the help.

Jonco

BTW: I Also made a donation to BFA in consideration of this great WordPress theme.

Flynn Feb 14, 2009 09:36 PM

Thank you, the donation might not have gone through. At least I didn't get one today and the last one from yesterday was from someone else. See also bottom fo this thread http://forum.bytesforall.com/showthread.php?t=384

I will get back to you about the ads tomorrow, I am leaving for today

Flynn Feb 15, 2009 09:24 AM

If you're running version 3.2 you should already have $postcount in index.php.
For the ad, put the code below into index.php, for instance before or after

PHP Code:

        </div><!-- / Post --> 

depending on whether you want to put it inside or outside the post container.

PHP Code:

<?php if ( (is_home() OR is_archive()) AND $postcount <= 1) { ?>
AD CODE
<?php ?>

is_archive covers Category, Tag, Author and Date based multi post pages.
is_home covers the home page (if a static page is set as homepage then only the homepage of posts) including page 2, page 3 etc.


All times are GMT -6. The time now is 09:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.