• Resolved connorjack

    (@connorjack)


    Hey,
    I have some [Google Adsense] ads on my site. I’d like to remove these if the user is logged in. I’ve tried a few methods but they don’t seem to be working. Any help?

    Thanks in advance

    PS: If it helps, this is the site that I am working on: https://simoperations.com/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Maybe this one?

    <?php
    if ( is_user_logged_in() ) {
        echo '<div class="ad" style="display:none;">';
    } else {
        echo '<div class="ad">';
    };
    ?>
    
    <!-- your ad code here -->
    </div>

    Peter

    Thread Starter connorjack

    (@connorjack)

    Wow! Thanks so much, pboosten! That’s done it! My users and I will be happy now!

    ?? ?? ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display Content Only to Non-Logged in Users’ is closed to new replies.