Skip to content

Instantly share code, notes, and snippets.

@tsbega
Forked from norewp/elementor-canvas-scripts.php
Created August 24, 2020 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsbega/3c5fc8fb90b54e61bba114a9759d432a to your computer and use it in GitHub Desktop.
Save tsbega/3c5fc8fb90b54e61bba114a9759d432a to your computer and use it in GitHub Desktop.
Custom scripts only on the Elementor Canvas template
<?php // You probably don't need to add this opening PHP tag!
function my_custom_canvas_scripts() {
$classes = get_body_class();
if ( in_array( 'page-template-elementor_canvas', $classes ) ) { ?>
<script type="text/javascript">
<!--[Custom Script]><!-->
//(function($) { //Uncomment this for no conflict jQuery
// Add your script here
//})(jQuery); //Uncomment this for no conflict jQuery
<!--[End Custom Script]><!-->
</script>
<?php
}
}
add_action( 'wp_footer', 'my_custom_canvas_scripts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment