Adsense?

  • Michaud68

    #7106

    I am using a plugin for adsense called quick adsense which puts my ads on all my pages and posts. I would like to use the themes adsense placement for the homepage and categories etc. is there a way to disable the ads for only pages and posts? I Searched the forums and found this to remove them from pages but don’t know how to add posts to this. Any help greatly appreciated.

    <?php
    function hide_adsense_if_page() {
    global $graphene_settings;
    if(is_page() ) {
    $graphene_settings['show_adsense'] = false;
    }
    }
    add_action( 'template_redirect', 'hide_adsense_if_page' );

    Anonymous

    #36981
    function hide_adsense_if_page() {
    global $graphene_settings;
    if( is_page() || is_single() ) {
    $graphene_settings['show_adsense'] = false;
    }
    }
    add_action( 'template_redirect', 'hide_adsense_if_page' );

    Michaud68

    #36982

    Thanks do i have to add the <?php like in the fist code that I found?

    Admin

    Syahir Hakim

    #36983

    Only if you haven’t already have that opening PHP tag in your file and haven’t closed it if you have one.

    http://www.php.net/manual/en/language.basic-syntax.phptags.php

    Michaud68

    #36984

    Thanks for the help! Love the theme by the way!!

    Admin

    Syahir Hakim

    #36985

    Marking thread as resolved. You can do this yourself as well.

Viewing 6 posts - 1 through 6 (of 6 total)

  • You must be logged in to reply to this topic.
Graphene Themes Forum