Support » Plugin: Ad Blocking Detector » Plugin Doesn't Like My Webpage!

  • Resolved The Author Jack Foreigner

    (@the-author-jack-foreigner)


    Okay, so I’ve found a workaround to getting Ad-Blocking Detector to only display on some Post Categories and not others…unfortunately, this plugin is stuck on one particular Post of mine!!

    http://jack-foreigner.com/chinese-century-novels — or .postid-2702 — keeps being treated as the target of the following CSS by some reason:

    .postid-2702 #aswift_1_expand {display: none !important}

    Now why should that be? Other CSS-whachamacallits like .category-meta work just fine, preventing Ad-Blocking Detector’s code from being output onto the page…but on Post ID 2702 above my otherwise valid CSS prevents the entire page from displaying — and only that very one!!

    Please help…it’s driving me kinda meshuggina!!! 🙁

    Or is it my writing the software don’t like?? 😉

    https://wordpress.org/plugins/ad-blocking-detector/

Viewing 13 replies - 1 through 13 (of 13 total)
  • The Author Jack Foreigner

    (@the-author-jack-foreigner)

    I guess what I’m really asking (thank you for your patience; not as articulate when it comes to coding) is: what CSS selectors (or whatever they’re called) does Ad-Blocking Detector offer??

    So far I can identify a few, like .first, .ABD_display, and #aswift_0_expand, but I need more to achieve one last thing….

    The Author Jack Foreigner

    (@the-author-jack-foreigner)

    Incidentally, I should say that I’m only asking such questions because Ad Blocking Detector appears to strip or override Advanced Ads’ native Display Conditions (don’t show in this category, or on this page, etc.) and so I have to resort to targeting and intercepting this (ABD’s) plugin’s output in the CSS!

    John Morris

    (@jtmorris)

    I’m not entirely sure what the first post is discussing. But let me answer your second question and elaborate a little. Maybe that will answer your question.

    Ad Blocking Detector outputs two containers on the page. One container has the content to display when ad blockers are detected. The other the content to display when no ad blockers are detected. The contents of each container is the code you give when creating the shortcode. The plugin uses JavaScript to detect ad blockers and determine which container is appropriate to show.

    The container for ad blocker detected content can be selected via CSS with the class of ABD_display_adblock. The container for no ad blocker detected content can be selected via CSS with the class of ABD_display_noadblock.

    If you want to select both containers, they both have a class of ABD_display.

    Therefore, if you wanted to hide all Ad Blocking Detector content on the site, you could use the following CSS rule:

    .ABD_display { display: none !important; }

    Or to block only ad blocker detected content, you could use:

    .ABD_display_adblocker { display: none !important; }

    ———————

    If you want to target all Ad Blocking Detector content on only specific pages/posts, then you can use a selector like you had above. To hide it on the post with id of 2702, use this:

    .postid-2702 .ABD_display { display: none !important; }

    I’m not sure why the CSS you specified blocked the entire page, but I’m not sure what the selector .postid-2702 #aswift_1_expand referred to. Perhaps if you could use the information I gave above to refine or alter your approach, you’ll get more information to give and I can help you more.

    ————————

    I’ve never used Advanced Ads, so I can’t elaborate as to what is happening. If it’s still an issue at that point, I will look into it this weekend.

    ————————

    I’m in class all day again tomorrow, and might not be able to respond until Friday. I’ll do what I can.

    The Author Jack Foreigner

    (@the-author-jack-foreigner)

    Hi, John,

    Thanks ever so much for your time and thoughts — no need to rush, of course, so help only at your convenience!

    Okay, so, this is the thing:

    I’m trying to suppress display of the upper left-hand corner ad unit for only certain Post Categories. I’m fine with CSS when there are no ad-blockers enabled, targeting .first, but when there is an ad-blocker present, what ABD, your plugin, does is revert to the Ad Blocker Detected shortcode — quite logically, of course. But for my purposes, I can no longer target .first in this case — that class doesn’t exist under the .ABD_display_adblocker container (which I can’t simply target since that removes all ad units and I only want to suppress just one)….

    That’s the context around my “second question,” as you put it. Now the “first question” (my initial comment here) is related: for some reason, Post ID 2702 is a really bad misbehaving webpage and I’ve had many weird issues with it suddenly, even though it’s been fine since its creation back in May…anyhow, the upshot is that targeting categories isn’t possible when it comes to this one webpage (Post ID 2702)…blah blah blah….

    Okay, so just to summarize: I can’t use .ABD_display_adblocker as it suppresses all ad units. What could the alternative be?

    John Morris

    (@jtmorris)

    At the moment, Ad Blocking Detector itself does not provide the facilities to do this. I’ll look into adding it momentarily. Off the top of my head, I think it will be easy to add.

    But there are other ways of doing it in the meantime. I think the easiest thing to do would be to edit your shortcode in the Ad Blocking Detector dashboard and wrap your code in a <div> with a known class or ID.

    For example, if your Ad Blocker Detected section code was this before:

    <p>This is code to display when ad blockers are detected.</p>

    Change it to this:

    <div id="upper-left-abd-adblocker">
         <p>This is code to display when ad blockers are detected.</p>
    </div>

    Then, in the CSS, use this to block the display:

    .postid-2702 #upper-left-abd-adblocker { display: none !important; }

    John Morris

    (@jtmorris)

    In an update I will push out in a few minutes, I’ve added something that should make CSS targeting easier.

    Now, in addition to the selectors I mentioned before, there are two new ones. The first, .ABD_display_wrapper, won’t help you much here. It targets a wrapping <div> around all the Ad Blocker Detected code output on the page.

    But, the second will probably be more helpful. It is ABD_shortcode_# where the # is replaced with the ID number of the shortcode. Each shortcode gets wrapped in a selector with their ID #. For example, if you were inserting the shortcode with ID #4, you could target the wrapper with .ABD_shortcode_4.

    Now, if you want to hide the Ad Blocking Detector shortcode ID #4 on .postid-2702, you should be able to do this:

    .postid-2702 .ABD_shortcode_4 { display: none !important; }

    —————–

    This is still limited as, if you use a shortcode in more than one place on your page, all instance of those shortcodes will be targeted. But I think it will work for what you are trying to do.

    The Author Jack Foreigner

    (@the-author-jack-foreigner)

    OMG, John…sometimes I really wish you weren’t so quick with the support — so that I can be forced to think things through a little more myself!! 😉

    Yes yes yes OF COURSE just add a <div> and style it…I feel like the Homer Simpson of WordPress.org!!! :-\

    Thanks, that really works…and thanks especially for the updates with more, erm, uh, “hooks” or whatever the CSS term is (selectors??)…now maybe you can answer a couple of VCR-programming questions I happen to have, too…. 😉

    Seriously, thanks a billion. I’m curious which option will prove best for my needs — but it’s nice to know I’ve got options!

    The Author Jack Foreigner

    (@the-author-jack-foreigner)

    Post Scriptum

    .postid-2702 .ABD_shortcode_4 { display: none !important; }

    —————–

    This is still limited as, if you use a shortcode in more than one place on your page, all instance of those shortcodes will be targeted. But I think it will work for what you are trying to do.

    S’okay, I’ll just have to create two instances of the same thing for different Post Categories…rahter inelegant as you mathematicians/programmers but good enough for us skript kiddiez! :-d

    The Author Jack Foreigner

    (@the-author-jack-foreigner)

    P.P.S.

    Sorry, forgot to mark this thread “resolved”…thanks again!!!

    The Author Jack Foreigner

    (@the-author-jack-foreigner)

    Okay…just an FYI, FWIW: the CSS

    <div id=”upper-left-abd-adblocker”>
    content
    </div>

    and

    .postid-2702 #upper-left-abd-adblocker { display: none !important; }

    doesn’t work. Sounds like it should but just doesn’t: the <div> tags are completely ignored! And yes I checked for orthographical errors.

    As for the second method, using the additional selectors provided by the latest plugin update, well…it doesn’t work either!!

    I don’t get it. Both methods appear totally logical. But they’re totally ignored by the browser! And yeah, I checked across different computers and even a Samsung tablet.

    Sorry, but now I’m really intrigued and so am opening this thread up again…maybe it’s just me, just my site or the theme I’m using???

    John Morris

    (@jtmorris)

    That is strange. Are you running any sort of performance plugin. Caching, file combining, and minification sometimes play havoc with theme changes. If so, can you temporarily disable it or, at least, clear caches.

    Also, if you’re not, can you try live editing the CSS using browser developer tools. I’m a Chrome fan, but Firefox, IE, and many others all offer tools for doing this. Editing Styles w/ Chrome

    By editing it live in the browser, you cut out all the potential problems involved with the server, loading, and plugin issues.

    The Author Jack Foreigner

    (@the-author-jack-foreigner)

    Hiya, John,

    First off, thanks for taking a trip down memory lane with me here — i.e., revisiting this formerly resolved thread.

    Yes, well, I do tinker with browsers’ “Inspect Element” features but that’s really the extent of my capabilities, ambitious as I am.

    Oh, no performance plugins, no caching or minification or anything. But I’m on Bluehost’s CloudFlare…some kinda DNN thingy….

    Anyway, I’ll see what I can figure out.

    The Author Jack Foreigner

    (@the-author-jack-foreigner)

    Hey John,

    Just an update on things: I’m abandoning this CSS approach in favor of the PHP-based one. Just less things to account for.

    Thanks again, as always, for your time and help!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Plugin Doesn't Like My Webpage!’ is closed to new replies.