Featured Posts

Earn Residual Income Residual income is a passive or recurring income that continues to generate after the initial effort. Most people earn "linear" income or receive a "one-shot" compensation. Royalties, rent from properties,...

Read more

Job Opportunity Looking for work? Want to earn a few extra bucks? Start full-time or part-time. Be your own boss. Have the flexibility and the freedom. It's a business opportunity where you supply consumers with services...

Read more

Get Paid While Using Your Phone Imagine getting paid each time you or someone else makes a phone call, watches tv, surfs the internet, or uses gas and electricity. Imagine getting paid every month, every year, or over an entire lifetime....

Read more

  • Prev
  • Next

Turn Off Google Ads in WordPress If Admin

3

Category : Programming, WordPress

You’ve implemented Google Adsense in your WordPress blog. Now, you want to avoid accidentally clicking on an ad to avoid being penalized by Google.

If you’ve manually added Google Adsense to your WordPress theme, this article is for you. If you are using one of many Google Adsense Widgets, this article might be for you assuming you know how to modify an existing widget.

This article will give you an idea on how to add a simple PHP code in your template to suppress Google Ads if a user or an admin is logged in to WordPress.

We will use the “is_user_logged_in()” function to determine if a user or an admin is logged in to Wordpress. A simple “if” statement is employed to display or not display the ad.

Sample 1 – The format:


...
Place your Google Adsense code here ....
...

Sample 2 – With actual Google Adsense Code:





Place this code to every Google Adsense code in your template. To view the ads, simply logout of WordPress.

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

Comments (3)

Hi, Ive got a couple of questions about your wordpress template that I started using (awesome) is it possible to talk directly I sen my email…Thanks

Don,

I’m not exactly sure what you meant. Can you rephrase your question?

VRy interesting to read it :P :D