0

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_ ));
}
  • Are they not being loaded, or are they just not working? Can you see the script tags on the page? – Jacob Peattie May 25 '18 at 13:00
  • I checked for it too... there are no script tags on the page. – Henrique Giuliani May 25 '18 at 13:01
  • Does the template have wp_head() and wp_footer() in it? – Jacob Peattie May 25 '18 at 13:02
  • Yes, i am using get_header() and get_footer() in the start/end of the template. – Henrique Giuliani May 25 '18 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.