How did you install the plugin? The script looks weird in your view source. Specifically all the HTML after the .js.
<script type='text/javascript' src='wp-content/plugins/ad-blocking-advisor/js/ad-blocking-advisor.js'%20defer%20onload='' defer onload=''></script>
Accessing that URL directly shows 404 – so this is part of the problem.
Are you using caching?
Can you remove the plugin and re-install it?
Thread Starter
coolph
(@coolph)
I installed the plugin normally through WordPress dashboard. I reinstalled it again but no luck.
And you’re right. The issue is that it is somehow sanitizing the URL by converting ‘ to & #039; and space to %20.
../js/ad-blocking-advisor.js'%20defer%20onload=''
From the source code of plugin I can see you’re using esc_url() function. Would that be causing the issue?
wp_register_script( "aba_script", esc_url( plugin_dir_url( __FILE__ ) . 'js/ad-blocking-advisor.js' ), array( 'jquery' ) );
I think you need to remove last ‘ inside esc_url(). Something like
'js/ad-blocking-advisor.js )',
This one was coming fine –
echo '<img src="' . plugin_dir_url( __FILE__ ) . 'images/1px-transparent.png" alt="">';
<div class="footer_ad"><img src="http://www.techiedelight.com/wp-content/plugins/ad-blocking-advisor/images/1px-transparent.png" alt="" style="display: none !important;"></div>
-
This reply was modified 8 years, 6 months ago by
coolph.
-
This reply was modified 8 years, 6 months ago by
coolph.
-
This reply was modified 8 years, 6 months ago by
coolph.
Hmm, maybe you’re right. This is the first I’m seeing this. Can you give it a try in your install (remove the last ')?
If that fixes it for you, I’ll do some testing here too and issue an update.
-
This reply was modified 8 years, 6 months ago by
Pat O'Brien.
Thread Starter
coolph
(@coolph)
Nope. Removing last ' didn’t work. Crashed my site. But on removing esc_url() function, the JavaScript is loaded fine.
wp_register_script( "aba_script", plugin_dir_url( __FILE__ ) . 'js/ad-blocking-advisor.js', array( 'jquery' ) );
Thanks for testing it out. I didn’t have a chance to get to it today. Let me test it on a couple of my test sites and I’ll issue an update
Just to send an update; I’ve updated the plugin to version 2.0 which fixes this issue and a couple of others.
Marking resolved. Thanks again for the help