Genesis Themes

  • Home
  • Genesis Tutorials
  • WP Tutorial
  • Twenty Fifteen Theme
  • Social Media
  • WP Plugins

How to Display Google Adsense After First Post in WordPress

Show Google Adsense after first post in WordPress :

There are several reasons to say WordPress is the best CMS. Mainly it is client friendly,bunch of plugins, themes,SEO friendly  and great support.Any thing is possible in WordPress,so here you can learn how to add Google adsense after first post in WordPress blog or home page.In every page this adsence add will appear which results you increase in earnings.Simply follow this tutorial to add Google adsense after first post in any WordPress theme.

Also see: Google adsense after first post in Genesis

adsense after first post

Go to Appearances > Editor >Single.php file.

Here's is the code to display Google adsense after post in WordPress

<?php if (have_posts()) : ?>
<?php $adcounter = 0; ?>
<?php while (have_posts()) : the_post(); ?>
<?php if ($count == 1) : ?>
          //Paste your Google Adsense code here
          <?php the_excerpt(); ?>
<?php else : ?>
          <?php the_excerpt(); ?>
<?php endif; ?>
<?php $adcounter++; ?>
<?php endwhile; ?>
<?php endif; ?>

 Code Explanation :

If you want to display google adsense after 2nd post then change the values in above code as below.

<?php if ($adcounter == 2) : ?>

<?php $adcounter = 1; ?>

You can change these values as per your requirement.

Need Help :

We hope this WordPress tutorial helped you learning how to display Google adsense after first post,second post and nth post in any WordPress theme.If you are facing any problem,then share your query in below comment box we will reply as early as possible.

Related Posts

  • How to Create a Mobile Friendly Responsive Menu in WordPress
  • Setting Up WordPress Breadcrumbs with Yoast SEO Plugin
  • Recommended WordPress Ping List 2017
  • WordPress : Remove Transient Options in Database
  • Error Establishing a Database Connection in WordPress
  • Disable Disqus Comments on Certain Pages in WordPress
  • How to Add Related Posts with Thumbnails in WordPress
  • How to Minimize DNS Lookups
  • Remove Query String from Static Resources in WordPress
  • The Ideal WP Fastest Cache Settings 2016

Bluehost and Siteground Coupons for January 2016.

Best Premium WordPress Themes from TemplateMonster
download wordpress themes from MonsterOne

Categories

  • Blog
  • Blogger
  • Genesis Tutorials
  • Social Media
  • Top Websites
  • Twenty Fifteen WordPress Theme
  • WordPress Plugins
  • WordPress Tutorial