fancybox question about missing jQuery

hello - i kept seeing “jQuery not found” or something like that, so i manually added the following line

<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

into this file:

/wp-content/plugins/fancybox-for-wordpress/fancybox.php

i am sure there is a better way to do this, but suddenly became quite lazy and this seemed like the fastest way to solve the issue.

so, in case i ever look at this again, any suggestions of a better way?

i kept seeing something about using wp_enqueue but that didnt seem to work - i kept getting “function not found” errors - its probably a theme issue but thought i would raise the issue here first in the forum.

note: i realize this needs to be redone every time fancybox upgrades.

Hi @edwardsmarkf,

I hope you are well today and thank you for your question.

Please note you are making changes in the plugin file therefore you have to make these changes again after plugin updation as changes made in the plugin files get lost on theme updation.

Instead please create a child theme of the theme you are using on your site as described on this page
Child Themes « WordPress Codex and then add the following code in the functions.php file of your child theme.

function childtheme_load_jquery() {
    wp_enqueue_script( 'jquery' );
}
add_action( 'wp_enqueue_script', 'childtheme_load_jquery' );

Best Regards,
Movin