Placing Ad Between WordPress Posts
Placing advertisements on any Website or Blog site is one of the greatest way to generate money from online. Over the years Google’s AdSense program has become widely popular along with few other online Advertising programs. Today in this post I will show you how to put Ad in between WordPress blog posts. You don’t need to be a web developer or designer to do this. Little HTML knowledge would be good enough to get it done. So, let’s get started.
Here is how to add Ads between WordPress Posts:
Step 1: Log into your WordPress admin panel.
Step 2: From the navigation menu, select Appearance -> Editor.
Step 3: From the Editor, find and select the “Main index template” (index.php) from the list of pages.
Step 4: Find the following line
<?php if (have_posts()) : ?>
Step 5: Add the following line, right above the Previous code.
<?php $count = 1; ?>
Step 6: Now find the following line
Step 7: Add the following code directly below the closing div tag (</div>) of the “entry” class. Now, place your Ad Code in between the following lines.
<?php if ($count == 1) : ?>
Your Ad Code
<?php endif; $count++; ?>
Step 8: Finally, click on update file & then check your post as if you are a reader of the post.
That is it, your are done. Please note that in order to change which post your ad is placed under, simply change the count number. Example: $count == 2 will place the ad under second post. This method of placing Ad works with most of the popular online ad services like AdSense, adBrite, Chitika etc. If you are using any other provider’s ad, it should work as well. Let us know if it works for you or not.
Warning: Creating default object from empty value in /homepages/46/d530413940/htdocs/e-dirts.com/wp-content/themes/dev/single.php on line 20