How to add adsense or any html code after first post?
Step I : Go to WordPress Dashboard >>Appearance >> Editor.Step II: Select the page to be edited say Home page ,category page or tag page (Here we will discuss about Home page i.e., index.php click on it)
Step III: Search for following php tag just press CTRL + F
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Step IV : Add following code before above as
<?php $bscount = 1; ?>
Step V: Now look for <?php endwhile; else: ?> and place <?php $bscount++; ?> above it.
Step: VI : Finally place this code where you want your ads to be appeared between Step IV and V
<?php if ($bscount == 1) : ?>
<!– Your HTML/Adsense code here –>
<?php endif; $bscount++; ?>
If you want do display ads after 2nd or 3rd post then you just have to replace “1″ by either 2 or 3 or with any no as per your requirement in all php tag showing “bscount == 1″.
No comments:
Post a Comment