Jump to content
Sign in to follow this  
danielj

Placing adsense ads after the 1st and 4th post on the front page

Recommended Posts

danielj    0
danielj

Website URL: http://www.whatsthatbug.com

Framework Version: 2.4

WordPress Version: 3.5.1

 

I want to show an adsense ad after the 1st and 4th post on the main page. I tried doing it in child_functions.php like this:

$x++; if ($x == 1) { 
  add_action('pagelines_loop_after_post_content', 'google_lc_ad'); 
} 

But that didn't work - it still shows after *every* post. Any suggestions on how/where I can accomplish this?

 

Thanks!

Share this post


Link to post
Share on other sites
James B    436
James B

Hi there, see Simon's example of the hook near the bottom of the page on this thread - http://www.pagelines.com/forum/topic/24255-adsense-displayed-on-home-page-first-two-posts-only/


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
danielj    0
danielj

Thank you! I did not search as well as I had thought. That worked perfectly (with a change to the math).

Share this post


Link to post
Share on other sites
James B    436
James B

No worries, glad it worked :-)


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×