jeudi 26 mars 2015

Enqueue script on specific WooCommerce template


I would like to enqueue a lightbox script on the WooCommerce page content-single-product.php.


I have tried the following via functions.php:



if(is_page_template( 'page-gallery.php' ) || is_page_template( 'content-single-product.php' )) {
wp_enqueue_script( 'theme-lightbox', get_template_directory_uri() . '/js/lightbox.js', array(), '20150323', true );
}


The script loads correctly on page-gallery.php, but not on the WooCommerce single product page. I assume this method only works for my theme page templates?





Aucun commentaire:

Enregistrer un commentaire