Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi,
    Please refer to this example page :https://b-website.com/hook-adblock-notify-display-modalbox-specific-pages
    You have to specify the page’s ID where you want the modal to appear.
    The modal box option have to be switched off to let the hook displayed it only when necessary.
    Cheers

    Thread Starter jdroberts

    (@jdroberts)

    Can you give me a few more details?

    I have a child theme…would I paste the code in function.php?

    Do I put the page ID here?

    $pageList = array(‘123′,’1234’); //page ID list

    Finally, where would I find my page ID? Is it the slug?

    Thread Starter jdroberts

    (@jdroberts)

    ???

    Wow… be patient…

    I have a child theme…would I paste the code in function.php?

    Yes

    Do I put the page ID here?

    $pageList = array(‘123′,’1234’); //page ID list

    Yes…

    Finally, where would I find my page ID? Is it the slug?

    No, it is not a slug, it is an ID : https://www.ads-software.com/support/topic/find-page-id?replies=5 or

    Thread Starter jdroberts

    (@jdroberts)

    Sorry, didn’t mean to be impatient.

    The code didn’t work. Here’s what I pasted into functions.php

    function filter_an_prepare($content){
            //get current page ID outside the loop
            $pageId = get_queried_object_id();
            $pageList = array('233'); //page ID list
    
            if(in_array($pageId,$pageList)){
    
                //CSS
                wp_enqueue_style('an_style');
    
                $content = preg_replace('/\"anOptionChoice\"\:\"(.?)\"/i', '"anOptionChoice":"2"', $content);
                $content =preg_replace('/\"anOptionCookie\"\:\"(.?)\"/i', '"anOptionCookie":"2"', $content);
    
            }
            return $content;
        }
        add_filter('an_prepare','filter_an_prepare');

    I double checked that 233 is the correct page ID. It’s still showing on every day.

    This function should work.
    As I said above :

    The modal box option have to be switched off to let the hook displayed it only when necessary.

    Please let me know.

    Thread Starter jdroberts

    (@jdroberts)

    It’s not working anywhere now. Here are my settings:

    Modal Box or Redirection: none
    Stats widget: no
    Cookies: no
    Random selector and files: both unchecked

    Activate Alternative message: Yes

    As written in the plugin description page, you have to check “Use random selectors and files”.

    Adblock Notify has been blacklisted by adblocker softwares but it is still working properly with the “Random selectors and files” option. Make sure to disable your adblocker to view screenshots in www.ads-software.com and in your admin area to view all the plugin’s options fields and the dashboard widget.

    Well, no news, seems to be solved.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Only on certain pages?’ is closed to new replies.