People add ads at different places on their blog, where they find it suitable or best. Areas can vary from header, Post header, Post footer, sidebar or other. Here I’m sharing with you a simple tip which will let you add Ads after each post on homepage. In fact, not only ads but any notice, text, subscribe to newsletter box or just anything, because we are going to create this area widgetized.
Create a Widget:
- First of all, we have to register a Widget are which we can call after each Post.
- Open your theme’s functions.php and add this code.
- If you theme does not contain functions.php.
- Open a blank notepad file, add this code. Save as functions.php and upload it in your theme’s folder.
<?php
register_sidebar( array(
‘name’ => ‘ad-insert’,
‘id’ => ‘ad-insert’,
‘before_widget’ => ‘<div id=”%1$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
) );
?>
Adding Widget to Index file
Now we have to call this created widget in the index file. For this you have to locate the “endwhile” near the end and put the following code directly above it, so that it looks like this.
<?php if ($count==2) { ?>
<?php dynamic_sidebar(ad-insert’) ?>
<?php } ?>
<?php $count = $count + 1; ?>
<?php endwhile; ?>
The above code will insert the “ad-insert” widget area right after the second post. You can change the $count==2 number to something else, according to the post you’d like the widget area to be displayed after.
If you really liked this tip, don’t forget to leave a comment. If you find problems inserting ad between Posts, you can always leave a comment and we’ll help you out !




That’s a really cool tutorial, Enk! Nice job!
I think between ads is one of the best places to put adverts on your blog as it gets so much exposure!

Simon | Teenius´s last blog ..Alternative Ways To Earn From Your Blog!
[Reply]
The placement of the ads does matter in earning. Nice concept.
Morgan | r4´s last undefined ..If you register your site for free at
[Reply]
thanks for this info.
designfollow´s last blog ..Best Practices for 6 Common User Interface Elements
[Reply]
Nice! Really very informative post

Ali´s last blog ..hello
[Reply]