Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
874 views
in Q2A Core by
Hello,

I received an email from Adsense said that I have to do not allow to ads be appeared on the page which contain questions and answers about some things. I see that pages is more and receive good traffic so I do not like to remove its Is there and method or code to block the ads from selected pages ?

Thank you.
by
I want to know this too, but you are asking about a keyword check before you display AdSense code like this (it is just an example not a working code)

if ($words ! = $AdsenseWords)
      echo "Adsese Code";
Else
     echo "";

Something like this... and you have to come up an array (list) of AdSense unacceptable words list also you have to create an array of words from every question and check those words over AdSense array and display the code or NOT

1 Answer

+2 votes
by
edited by

I can't think of a way to do this out of the box in Q2A, but it should be possible using an advanced theme.

You didn't say how you were displaying Adsense currently (the built-in plugin?) but you could change it to the theme instead. For example at the top of the main() function.

Once you have done that, you can then add an if clause to check what page you're on. Something along the lines of

public function main()
{
    if (strpos('word', $this->content['title']) === false) {
        $this->output_raw('output adsense code here');
    }

    parent::main();
}

 

by
I am using widget Anywhere to display the ads
...