Incorrect hardcoded JS loading path; dublicate jquery
-
#PROBLEM #1:
Plugin is using hardcoded jquery.js loading without checking that jQuery is allready loaded / or usingwp_deregister_script / wp_enqueue_script
..
This breaks many things..#SOLUTION:
Comment out that jquery loading line (jQuery is already loaded in 99% cases anyway and the rest can be handled by simplewp_enqueue_script('jquery');
..)—–
#PROBLEM #2:
JS loading is hardcoded using incorrect plugin dir path (plugin dir isfacebook-album-photos
, notfacebook-photos
):
<script type='text/javascript' src='".get_bloginfo('wpurl').'/wp-content/plugins/facebook-photos/jq-lightbx/js/jquery.lightbox-0.5.js'."'></script>
#SOLUTION:
Recode it to use wp functionplugins_url
to generate path:<!-- <script type='text/javascript' src='". plugins_url('/jq-lightbx/js/jquery.js', __FILE__) ."'></script> --> <script type='text/javascript' src='". plugins_url('/jq-lightbx/js/jquery.lightbox-0.5.js', __FILE__) ."'></script> <link rel='stylesheet' type='text/css' href='". plugins_url('/jq-lightbx/css/jquery.lightbox-0.5.css', __FILE__) ."' media='screen' />
—–
#PROBLEM #3:
WP un-aliases jQuery$
varible, so make sure to change your code (or use wrapper):
$(function($) {
#SOLUTION:
jQuery(function($) {
- The topic ‘Incorrect hardcoded JS loading path; dublicate jquery’ is closed to new replies.