Placing adsense after first post on homepage need help


#1

Hiya…
I wanted to insert and adsense right after the first post on the home page… I am not talking about individual Single post…
You can check my site layout here
http://www.bytewiki.com
I have search over the internet but couldn’t find an appropriate answer…

I think i need to do some editing here…

[php]if ( ! ( is_home() && $graphene_settings[‘frontpage_posts_cats’] && ! have_posts() ) ) {
while ( have_posts() ) {
the_post();
get_template_part( ‘loop’, ‘index’ );
}
}[/php]

I need something like this integrated into the code…
Please note:i want to place the ad only after first post.

[php]<?php if ( $postcount == 1) { ?>
Adsense Code Goes Here

<?php } ?>[/php]

Please if some one can help me with this…thanks


#2

Well, without studying your entire setup, it looks like the posts are here:
while ( have_posts() ) {
the_post();
get_template_part( ‘loop’, ‘index’ );
}

So, just before that part create a variable, like $firstpost=0;
Then inside the above post(); use this just after the post()…
if($firstpost==0){
adsense goes here…
$firstpost=1;
}
So, when the first post is posted, the adsense would go next.
After that first post, no more adsense would be displayed…
Something like that should work… Good luck…


#3

Thanks for your help.