0

I have looked over carefully at the scripts file for a WordPress plugin I am developing and I also looked at a similar post:

javascript file not working when linked from HTML

but the answer above has not worked either. I am not sure why the javascript file is not loading.

Here is the includes/newsletter-subscriber-scripts.php:

<?php

// Add Scripts
function ns_add_scripts(){
        wp_enqueue_style('ns-main-style', plugins_url().'/newsletter-subscriber/css/style.css');
        wp_enqueue_script('ns-main-script', plugins_url().'/newsletter-subscriber/js/main.js');
}

add_action('wp_enqueue_scripts', 'ns_add_scripts');

Here is the javascript file that is not loading in /newsletter-subscriber/js/main.js:

alert('Linked');
4
  • What do the developer tools in your browser say about it? Commented Dec 24, 2016 at 20:42
  • @SamiKuhmonen, the Console is completely blank. Commented Dec 24, 2016 at 21:06
  • And the network part which shows what it tries to load and the status codes? Commented Dec 24, 2016 at 21:06
  • @SamiKuhmonen, no javascript is loading from the plugin and everything is 200 with the exception of the jquery which is 307. Commented Dec 24, 2016 at 21:22

1 Answer 1

0

Did you check it out that its enqueuing in front end you can see script tag in your HTML output? of its coming than might be your browser java-script is off. check it or you can add link to your site so than someone can debug it

thank you

Sign up to request clarification or add additional context in comments.

1 Comment

I didn't test it, but I think it had to do with the custom WordPress theme I was testing it with because when I tried the plugin on another custom WordPress theme I created it worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.