You need to pass it as a function, or you already have but didn’t copy the whole code? If you did not do it, it should look something like this
function page_template_not_enqueue() {
if ( !is_page_template( 'page-full-width.php' ) ) {
wp_enqueue_script( 'flickity-js', get_template_directory_uri() . '/js/flickity.js',
array(), filemtime( get_stylesheet_directory() . '/js/flickity.js' ), true );
}
}
add_action('wp_enqueue_scripts', 'page_template_not_enqueue');
is_page_template function won’t work if you have not defined a page as a WordPress template, you can read up on that here, in short, your page templates need to start with this
<?php
/*
Template Name: Page Full Width
Template Post Type: page
*/
// Page code here...
If this still doesn’t work you can try getting the template name with the global $template var, I have not experimented with this second option, I suggest you just make your page template a custom word template with this comment I posted above, but if I was to try and go the other way around I would probably try to do something like this
function page_template_not_enqueue() {
global $template
if ( basename( $template ) === 'page-full-width.php' ) {
wp_enqueue_script( 'flickity-js', get_template_directory_uri() . '/js/flickity.js',
array(), filemtime( get_stylesheet_directory() . '/js/flickity.js' ), true );
}
}
add_action('wp_enqueue_scripts', 'page_template_not_enqueue');