0

I've read about and configured my own scripts using

wp_enqueue_script

and setting my script as jQuery-dependant, but how can I reorder jQuery when the script is from a plugin?

<script type="text/javascript">
                function ytc_init_MPAU() {jQuery('.ytc-lightbox').magnificPopupAU({disableOn:320,type:'iframe',mainClass:'ytc-mfp-lightbox',removalDelay:160,preloader:false,fixedContentPos:false});}jQuery(window).on('load',function(){ytc_init_MPAU();});jQuery(document).ajaxComplete(function(){ytc_init_MPAU();});
            </script>
            <link rel='stylesheet' id='dashicons-css' href='http://elinfluencer.dosdev.com/wp-includes/css/dashicons.min.css?ver=4.8' type='text/css' media='all'/>
            <link rel='stylesheet' id='thickbox-css' href='http://elinfluencer.dosdev.com/wp-includes/js/thickbox/thickbox.css?ver=4.8' type='text/css' media='all'/>
            <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js?ver=1.12.4'></script>
  • 2
    Looks like you're not using the jQuery that comes with WP core. That would be your issue. Instead of dequeuing core jQuery and enqueueing a version from Google, just make your plugin script dependent on core's version of jQuery. – WebElaine Jun 21 '17 at 16:00
  • edit your question and share your code instead of screenshot please – Mayeenul Islam Jun 21 '17 at 16:06
  • @WebElaine: I'll take a look at that. This is legacy installation, not one that I created. Thank you for your input. – MauF Jun 21 '17 at 16:20
-1

Just as @WebElaine observed, jQuery was being used incorrectly and twice. I removed the external call and edited my script accordingly to use the core's version.

Thanks.

|improve this answer|||||

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.