Okay
  Public Ticket #796330
Ads not working
Closed

Comments

  • redfoo started the conversation

    I have put adsense codes in all the places where ads go. Like in snew Options and i have use the ad widgets, Ads do not display. When i paste adsense in a post it displays. Pls help thanks -foo

  •   redfoo replied privately
  •  93
    djwd replied

    Hi there,
    thank you for your purchase.

    if it's a bug it will definitely get fixed in the first update! By inspecting your webpage with Chrome tools though this error get triggered:

    Uncaught TagError: adsbygoogle.push() error: All ins elements in the DOM with class=adsbygoogle already have ads in them.

    Please make sure the Google code is correct before troubleshooting this any further, if you have the chance testing the same code with another theme or by pasting it directly in a template file should also help understanding the cause of the issue.

    Thank you


    Regards
    djwd

  •  93
    djwd replied

    Hi there,
    quick update:

    It actually turned out to be a bug caused by SNEWS security filters. If you wish, you could try this fix and let me know if it worked 

    Open functions.php and replace the whole function starting from line 1177, with the following:

    // Allowed Tags for Ads and Adsense
    
    function snews_allowed_ad_tags() {
    
    $allowed_tags = array(
     'a' => array(
     'class' => array(),
     'href'  => array(),
     'rel'   => array(),
     'title' => array(),
     ),
    'img' => array(
     'alt'    => array(),
     'class'  => array(),
     'height' => array(),
     'src'    => array(),
     'width'  => array(),
     ),
     
     'ins' => array(
     'style'     => array(),
     'data-ad-client' => array(),
     'data-ad-slot'   => array(),
     'class' => array(),
     ),
     
     'script' => array(
     'async'  => array(),
            'src'  => array(),
            'type'  => array(),
            'data-id'  => array(),
            'data-format' => array(),
     ),
     );
     
     return $allowed_tags;
    }

    In case you're willing to try this out, please let me know if that fixes your issue with AdSense code, thank you!

    Regards
    djwd