Skip to content

Instantly share code, notes, and snippets.

@ideadude
Created October 2, 2020 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideadude/028266c33c30d806d0453e7a6018f782 to your computer and use it in GitHub Desktop.
Save ideadude/028266c33c30d806d0453e7a6018f782 to your computer and use it in GitHub Desktop.
Some examples of showing AdSense code for certain members only.
<?php
// show ads to non-members and level 3
if( pmpro_hasMembershipLevel( array(0,3) ) ) {
?>
<script>//...</script>
<?php
}
// use the pmpro_displayAds function
// https://www.paidmembershipspro.com/documentation/content-controls/hide-ads/
if ( function_exists( 'pmpro_displayAds' ) && pmpro_displayAds() ) {
?>
<script>//...</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment