Hi.
I want to add 2 google ads in main page or in category: one adsense below the first post and one adsense below the second post.
I use this code:
<?php $count = 1; ?> /* before <?php if (have_posts())... */
and after this
<?php if ($count == 1) : ?>
code adsense
<?php endif; $count++; ?>
and so, I have a adsense below the first post, but I want also another adsense below the second post.
How?
Thanks
Sorry,
I found the solution.
Before this: <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
I put this:
<?php
$postnum = 1;
$showadsense1 = 1;
$showadsense2 = 2;
?>
Before this:<?php endwhile; else: ?>
I put this:
<?php if ($postnum == $showadsense1) {
echo '
code adsense
';
} ?>
<?php if ($postnum == $showadsense2) {
echo '
code adsense
';
} ?>
<?php $postnum++; ?>
WPContent.com
Member
Posted 3 years ago #
Hi Erfo,
I posted a video tutorial on how to do this. The video can be found here: http://www.wpcontent.com/post/190.
I hope that helps,
Eric
ishan001
Member
Posted 2 years ago #
Works like a charm! Thanks a lot.