Created
May 28, 2021 04:31
-
-
Save wtmujeebu/a1405d99b8fe8a97c08e2f9d9f4799a7 to your computer and use it in GitHub Desktop.
Add href to links - CookieYes GDPR Cookie Consent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp_footer', 'wt_cli_add_href_to_links'); | |
function wt_cli_add_href_to_links() { | |
if (class_exists('Cookie_Law_Info')) { | |
?> | |
<script> | |
jQuery(function($) { | |
wt_cli_links = $('#cookie-law-info-bar a, #cliSettingsPopup a'); | |
wt_cli_links.each(function() { | |
if($(this).attr('href') === undefined) { | |
$(this).attr('href', '#'); | |
} | |
}); | |
}); | |
</script> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment