This topic has 11 replies, 3 voices, and was last updated 9 years by Radu.

  • Author
  • #153317
     hejms
    Participant

    Hi Sweetdate Support.

    I just got accepted by Google to use ads on my site.

    Paid Membership Pro says that you should use a plugin called “Easy Adsense” if you want to hide the ads for some memberships, but I can’t seem to find any plugin that are called that?

    It also suggest you can write ”

    COPY CODE
    if(pmpro_displayAds())
    {
    //insert ad code here
    }


    around the script, but if I do that it doesn’t work at all.

    Or maybe I’m just doing it wrong?
    I put a widget with text/html and write the code, but it doesn’t do anything.

    If I write it without “if (pmpro displayAds())” and so on, it works, but then all my members can see the ads, and isn’t hidden for VIP-members.

    Kind regards
    Henrik

    #153441
     Laura
    Moderator

    Hello, this one? https://es.wordpress.org/plugins/easy-adsense-lite/
    You could use this instead

    COPY CODE
    
    <?php if ( pmpro_hasMembershipLevel(array(3))) { ?>
    AD SCRIPT HERE
    <?php } ?>
    

    Basically, the membership level 3, can see ads, the others wont
    Just change the number

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #153454
     hejms
    Participant

    Yeah that was the plugin I found, but that doesn’t hide the ads automatically like the plugin Paid Memberships Pro were talking about 🙂

    But I tried to use your code inside the plugin, but it doesn’t work. It shows the ads for all membership users (all ID’s).

    I then tried to write it into the Text/HTML widget, but it just says “Error occurred. Please reload the page and try again” and it doesn’t save the code inside it.

    #153633
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #153637
     hejms
    Participant

    Thank you! 🙂

    #153715
     Radu
    Moderator

    Hi,

    This conditional tag it works make sure to not making something wrong

    COPY CODE
    
    //1,2 represents id's of packages that you want to see your message
     
    if(pmpro_hasMembershipLevel(array(1,2), get_current_user_id())){
        echo 'banner code'
    ;}
    }
    

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #153775
     hejms
    Participant

    Hmm I’m not exactly sure where you want me to write this code? :/

    #153869
     Radu
    Moderator

    If you use those in widget area the php codes sure will not work and you will have to use shortcodes

    All pmpro conditional shortcodes are here :

    So you will have to place your banner code inside the shortcodes

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #153883
     hejms
    Participant

    Okay but where exactly should I write these?
    If I write them inside the plugin, the ad shows, but there’s also the text “[membership level=”0,2″]” before the ad, and “[/membership]” after the ad.

    And if I write anything in the text-widget it just says error, and nothing works.

    #153914
     Radu
    Moderator

    From example in the widget area as you had said in the initial post

    [membership level=”1″]
    banner code for level 1
    [/membership]

    the shortcodes works in text area from widgets

    And so on..

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #153931
     hejms
    Participant

    Thank you, that works!

    The problem was that I went into “Appearance – Customize” and then put the text into widgets in there.
    And that didn’t work.

    But this method works, thank you 🙂

    #153992
     Radu
    Moderator

    Great

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?