I've been trying to implement a code provided by a wordpress plugin maker and I need a bit of help confirming if it works or not. The plugin in question is the PaidMembership Pro and it provides a possibility to hide ads for members. This is the snippet of code I should add to the template:
if ( function_exists( 'pmpro_displayAds' ) && pmpro_displayAds() ) {
//insert ad code here
}
The ad code is a simply google adsense code:
<script data-ad-client="ca-pub-111111111111111" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
I have no idea how to do it right. I tried adding it like this to wordpress header.php but wordpress throws me an error.
<?php if ( function_exists( 'pmpro_displayAds' ) && pmpro_displayAds() ) {
<script data-ad-client="ca-pub-111111111111111" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
} ?>
I tried a couple of other variations too but didn't seem to work. Could someone help me out at least pointing me to a direction where I can look for answers? How the if should be wrapped or should it be at all? If I don't wrap it at all, it just shows up on the top of the frontend.
Thanks
Aucun commentaire:
Enregistrer un commentaire