• Home
  • Project
  • Slider
  • Custom Website Design
  • Services
  • Social Media
  • Blog
  • Contact
    • Request a Quote

Areuconnected.com

Just another WordPress site

  • Home
  • Code Snippets
  • Genesis
You are here: Home / Genesis / Display Google Adsense after first post

Display Google Adsense after first post

June 7, 2011 by onnoysomoy 2 Comments

If you are using Genesis Theme Framework and would like to display Google Adsense or any advertisement code after the first post on the homepage, archives, and search results page, add the code below to the child theme’s functions.php file.

add_action('genesis_after_post', 'wpchildthemes_ad_after_first_post');
function wpchildthemes_ad_after_first_post() {
global $loop_counter;
if (!is_singular() && $loop_counter == 0) { ?>
ADD YOUR GOOGLE ADSENSE CODE HERE
<?php }
}

The code above which you add should be placed anywhere after this:

require_once(TEMPLATEPATH.'/lib/init.php');

And before the following closing code (if it exists):

?>

Thats it. Let me know your experience after using this snippet. Also please share if you have tricks complete this kinda job.

Filed Under: Genesis Tagged With: code snippets, genesis, genesis framework, google addsense

Comments

  1. web hosting says:
    January 14, 2012 at 9:08 pm

    I have learned a lot from your post and I am glad that there are still people with such great ideas. web hosting company best web hosting canadian web hosting

    Reply
  2. cialis to buy says:
    January 16, 2012 at 10:24 am

    Only dead or blind don’t change opinions. I hope many of us will change it after reading this post. Thanks. cialis to buy

    Reply

Speak Your Mind Cancel reply

*

*

Recommended Hosting

cpanel shared hosting

Company info

  • Home
  • About
  • Portfolio
  • Services
  • Qoute Us
  • Contact Us

Receive great tips via email

Our Partners

  • partners
  • partners
  • partners
  • partners

Top Stories

  • Removing genesis post_info from a Single or multiple Category
  • Insert custom content after single post
  • How to Add an Additional Wrap on Genesis Child Theme
  • Genesis Framework – Footer
  • Customizing Genesis Footer Content

Valid XHTML 1.0 Transitional