• Resolved jurijsmsk

    (@jurijsmsk)


    Hey.

    Looping ads while using adblocker causes layout break.

    Img Example 1
    Img Example 2

    Was trying solve it by adding id to advertise item div:

      if(adblock) {
           document.getElementById("divId").style.display = "none";
         }

    But it only solves first first item alignment.

    Example page

    Any solutions?

    • This topic was modified 2 years, 8 months ago by jurijsmsk.
    • This topic was modified 2 years, 8 months ago by jurijsmsk.
    • This topic was modified 2 years, 8 months ago by jurijsmsk.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks for your post.

    Just add these extra classes ad-zone ad-space ad-unit textads banner-ads banner_ads on the item div. hope the issue will resolve.

    add_action('post_grid_loop', 'post_grid_loop_ads_26022022');
    
    function post_grid_loop_ads_26022022($args){
    
        $loop_count = isset($args['loop_count']) ? $args['loop_count'] : '';
        $post_id = isset($args['post_id']) ? $args['post_id'] : '';
        
        if($loop_count == 1 || $loop_count == 3){
    
            ?>
                <div class="item ad-zone ad-space ad-unit textads banner-ads banner_ads"> <!-- add these classes -->
                    <a href="#ads-url"><img src="https://i.imgur.com/LWCYk60.png"></a>
    
                </div>
            <?php
        }
    }
    • This reply was modified 2 years, 7 months ago by azizulraju.
    Thread Starter jurijsmsk

    (@jurijsmsk)

    Seems like fixed issue.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Layout breaks if user using adblock while looping ads.’ is closed to new replies.