Javascript not being loaded only in custom taxonomy template

I have a taxonomy called categorias_de_receita in my plugin and a custom template for displaying this taxonomy posts. I don’t know why Javascript files are not being loaded only in this specific template.

There are no errors, no 404, etc. It is like wp_enqueue_script is not being called only in this specific template (other pages are working fine).

Here’s the function:

// Enqueue Scripts
function la_enqueue_scripts() {

//Styles are being loaded
wp_enqueue_style( ‘slick’, LA_RECEITAS_PUBLIC . ‘css/slick.css’, array(), ‘all’);
wp_enqueue_style( ‘slick-theme’, LA_RECEITAS_PUBLIC . ‘css/theme/slick-theme.css’, array(), ‘all’);
wp_enqueue_style( ‘font-awesome’, “https://use.fontawesome.com/releases/v5.0.13/css/all.css”);
wp_enqueue_style( ‘la-receitas’, LA_RECEITAS_PUBLIC . ‘css/la-receitas.css’ , array(), ‘all’);

// Not being loaded
wp_enqueue_script(‘slick’, LA_RECEITAS_PUBLIC . ‘js/slick.min.js’, array(‘jquery’), null, true);
wp_enqueue_script(‘mixitup’, LA_RECEITAS_PUBLIC . ‘js/mixitup.min.js’, array(), null, true);
wp_enqueue_script(‘mixitup-pagination’, LA_RECEITAS_PUBLIC . ‘js/mixitup-pagination.min.js’, array(), null, true);
wp_enqueue_script(‘la-receitas’, LA_RECEITAS_PUBLIC . ‘js/la-receitas.js’, array(), null, true);

}
add_action(‘wp_enqueue_scripts’, ‘la_enqueue_scripts’);`

LA_RECEITAS_PUBLIC constant:

if ( !defined(‘LA_RECEITAS_PUBLIC’)){
define(‘LA_RECEITAS_PUBLIC’, plugins_url(‘/la-receitas/public/’, _FILE_ ));
}

Read more here:: Javascript not being loaded only in custom taxonomy template

Leave a Reply

Your email address will not be published. Required fields are marked *