How to Apply Code Snippet to Sub-Directory and Paths
-
Good Day,
Is there a way we can modify the code snippet given below such that it applies not only to our main ‘blog‘ page, but also all subsequent paths? For example, /blog/our-new-widget and /blog/making-plugins-better. We can confirm ‘blog/*‘ (using a wildcard) does not work.
Thank you!
function change_avada_privacy_label() {
if ( is_page( array( 'news', 'blog', 'events', 'contact' ) ) ) {
?>
<script type="text/javascript">
// select all elements with the class name "fusion-privacy-label"
var elements = document.getElementsByClassName("fusion-privacy-label");
// change the innerHTML of each selected element
for (var i = 0; i < elements.length; i++) {
elements[i].innerHTML = "For privacy reasons, we need your permission to load our content.";
}
</script>
<?php
}
}
add_action('wp_footer', 'change_avada_privacy_label');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.