• Resolved wake surfer

    (@trik_sea)


    My client is making some changes to their website in staging and I’ve had to implement a different external URL popup notifier. I added a new function to the staging site which is interfering with every plugin I’ve tried to have an external link popup notice site wide.

    The line in question is: This Cookie Policy was synchronized with?cookiedatabase.org?on October 9, 2020

    When the user clicks the link a popup appears on the current live site. In staging it won’t work this way due to the above mentioned limitation. I’m able to add a class to relevant links on the site but because this is in the Complianz template I can’t figure out how to target it. Do you have any suggestions how to target this specific link to add an additional class to it?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor jarnovos

    (@jarnovos)

    Hi @trik_sea,

    I’ve visited your Cookie Policy page and already saw that a nice pop-up/modal window appears when you click the CookieDatabase.org link in the sentence that you attached.

    Therefore I’m assuming that you might have already found the solution in the meantime.

    Would you require any further assistance from our side on the matter?

    Kind regards, Jarno

    Thread Starter wake surfer

    (@trik_sea)

    As I mentioned, this is happening in staging. The live site is the previous version of this page which is listed as an example of what I’m trying to do. After a bunch of messing around and nothing working I found the right file in the plugin and modified it by adding the class name to this line: a href=”https://cookiedatabase.org/” target=”_blank” class=”exit-notifier”

    Will this work? How do I replace the existing cookie-policy-us.php template with my customized cookie-policy-us.php template?

    I have a child theme in place and am assuming it goes somewhere in there.

    • This reply was modified 1 year, 10 months ago by wake surfer.
    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @trik_sea,

    I’d recommend overriding the document HTML with a PHP filter, otherwise you would indeed lose those changes to the template files when updating the plugin.

    You can add the below filter as a .php file to the folder /wp-content/mu-plugins/, this will replace the CookieDatabase link in the sentence that you mentioned, and adds a class “exit-notifier” (example page here).

    <?php
    function cmplz_edit_document_html($html, $type, $post_id){
    	$old_string = '<a  target="_blank">cookiedatabase.org</a>';
    	$new_string = '<a class="exit-notifier"  target="_blank">cookiedatabase.org</a>';
    	$html = str_replace($old_string, $new_string, $html);
    	return $html;
    }
    
    add_filter('cmplz_document_html', 'cmplz_edit_document_html', 10, 3);

    Kind regards, Jarno

    Thread Starter wake surfer

    (@trik_sea)

    You’re awesome! That works! When WordPress updates will that folder be overwritten?

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @trik_sea,

    Great, glad to hear! The MU Plugins folder will persist when updating WordPress, so you’re good to go.

    Kind regards, Jarno

    Thread Starter wake surfer

    (@trik_sea)

    Thank you so much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add popup to cookie policy’ is closed to new replies.