Today we are discuss about how to insert ads between posts in WordPress. There are Multiple way to insert adsense advertisement between posts in wordpress
You can add ads between post using the WordPress Plugin and Also Using the WordPress Coding.
You can add insert add between post using following the Plugin.
- Ad Inserter – WordPress Ads Management
- Insert Post Ads
- AdSense Plugin WP QUAD
You can Download Following Plugin using the WordPress.org or direct add using the WordPress Dashboard.
You can Also add Between Post using the Simple Php Functlity. You have to some change in Your Code. That is the Best way to Insert Ads between Posts in WordPress.
You have to Following the Simple Step
- Open Your single.php and Index.php (*This Name is Depend on your wordpress theme)
- Find the Following Code
1<?php while ( have_posts() ) : the_post(); ?>
- Copy this line and Paste this line
1<?php $count = 1; ?>
It’s Looking like this
12<?php $count = 1; ?><?php while ( have_posts() ) : the_post(); ?>
- Paste this code in Your While loop
1<?php if ($count%2 == 0) : ?><!--?prettify linenums=true?-->
1234<?php if ($count%2 == 0) : ?>// You ads is Repeat after every 2 Post//Paste Your Adsense Code Here<?php endif; $count++; ?>
1//Paste Your Adsense Code Here <?php endif; $count++; ?>
The Complete code is the something like this
<?php $count = 1; ?>
<?php while ( have_posts() ) : the_post(); ?>
// Here is the Default Post Structure
<?php if ($count%2 == 0) : ?>
//Paste Your ads Code Here....
<?php endif; $count++; ?>
<?php endwhile; ?>
This is the Best and Easy Way to Insert ads Between Post without Using the Plugin. You can also using this code for Insert images text and video between Post.