If Admin Hide Ads, If not, show?
-
Hi,
I am wondering how to show ads for users but not for admin(s). I want to hide Google Adsense and Google Analytics scripts since I won’t click ads or want to track myself.I have this snippet of code but it seems not to work as desired:
<?php if ( !is_admin() ) : ?> Hide me <?php else : ?> show me <?php endif; ?>
This bit of code doesn’t work, is there anything wrong with it?
I also tried this script:<?php if ( is_user_logged_in() ) { echo 'Welcome, registered user!'; } else { echo 'Welcome, visitor!'; }; ?>
Which worked but I want members to see ads.
Is there anyway to modify either bit of code to do as described?
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘If Admin Hide Ads, If not, show?’ is closed to new replies.