Adsense Code

Hello,

How can i insert adsence ads above or below to a Q&A page?

  • ThePath
    • The Bug Hunter

    Hi volkanankara

    Thanks for being a member and your post.

    I havent used this plugin before so bare with me, Im sure others who have will chip in also.

    However looking at the plugins files I can see it uses some custom templates in:

    qa/default-templates

    I see they are using action hooks like:

    <?php do_action( 'qa_before_content', 'single-question' ); ?>

    Im quite new to action hooks and filters but perhaps someone can confirm if something along these lines would work in the functions.php file

    function adsense($ad) {
    $ad = "adsense code";
    return $ad;
    }
    add_filter('qa_before_content'', 'adsense');

    This (if it works) will put the ad code before the content of q&a. The hook for after the content is: qa_after_content

    But you should look through the plugins template file as there are others you may wish to use.

    This might make good reading for this issue: http://codex.wordpress.org/Plugin_API#Filters

    Cheers

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.