Custom .js not working after update

Hello,

I have a template for a page at https://memorializeme.com/memorials/

It pulls information from a secure webapp to populate the page.

I was helped in integrating the .js functions in my child theme on this thread: https://theme.co/apex/forum/t/adding-scripts-php-and-js-files-to-x-child-theme/33825

I have only done two things since I was able to get it working flawlessly with your help:

  1. I started using simple SSL and installed WordPressHTTPS plugin.

  2. I updated X and Cornerstone a couple times.

I turned off the SSL and deactivated the HTTPS plugin and that did not fix the problem. I also double-checked that all of the .js & .css file are present on the server and in the correct directories within the child theme.

Any help you can give me in figuring out why the .js won’t load anymore would be greatly appreciated.

Thanks,
Don

Hello There,

Thanks for writing in!

When you switched to https, simply go to Settings > General and set the Site URL and the WordPress Address URL to use https. And then make sure that your .js and .css files enqueued to the theme is using https as well. Would you ming sharing the code that you may have added in your child theme to load those JS and CSS files?

Please let us know how it goes.

Hi @RueNel,

Thanks for the quick reply. The URLs in general settings were changed to https when I set up the SSL.

I don’t know how to make sure the .js and .css files are enqueued to the theme using https.

Here is the code that was added to the functions.php file for the child theme:

add_action( ‘wp_enqueue_scripts’, ‘x_add_custom_js’ );

function x_add_custom_js() {
if(is_page_template (‘template-memorials.php’)) {
wp_register_script( ‘x-customscroll-script’, get_stylesheet_directory_uri() . ‘/js/jquery.mCustomScrollbar.js’, array( ‘jquery’ ), ‘1.0.0’, true );
wp_enqueue_script( ‘x-customscroll-script’ );
wp_register_script( ‘x-custom-script’, get_stylesheet_directory_uri() . ‘/js/customscript.js’, array( ‘jquery’ ), ‘1.0.0’, true );
wp_enqueue_script( ‘x-custom-script’ );

  wp_enqueue_style( 'mCustomScrollbar', get_stylesheet_directory_uri() . '/css/jquery.mCustomScrollbar.css', NULL, X_VERSION, 'all' );

}
}

Thanks,
Don

Hello Don,

Your code is valid and correct. I am sure the error does not come from that code. It must be some other reason why it is no longer working. Would mind sharing your WP site url and details so that I can investigate further?

Thanks.

I am saving the wordpress login and sftp info in a secure note.

Hello There,

it seems that there is a JS error on the Memorial page:

jquery.js?ver=1.12.4:4 GET https://portal.memorializeme.com/memorandum/getLatestImages 0 ()
send @ jquery.js?ver=1.12.4:4
ajax @ jquery.js?ver=1.12.4:4
n.(anonymous function) @ jquery.js?ver=1.12.4:4
getJSON @ jquery.js?ver=1.12.4:4
(anonymous) @ customscript.js?ver=1.0.0:5
i @ jquery.js?ver=1.12.4:2
fireWith @ jquery.js?ver=1.12.4:2
ready @ jquery.js?ver=1.12.4:2
K @ jquery.js?ver=1.12.4:2
jquery.js?ver=1.12.4:4 GET https://portal.memorializeme.com/memorandum/getRecentMemorials 0 ()
send @ jquery.js?ver=1.12.4:4
ajax @ jquery.js?ver=1.12.4:4
n.(anonymous function) @ jquery.js?ver=1.12.4:4
getJSON @ jquery.js?ver=1.12.4:4
(anonymous) @ customscript.js?ver=1.0.0:29
i @ jquery.js?ver=1.12.4:2
fireWith @ jquery.js?ver=1.12.4:2
ready @ jquery.js?ver=1.12.4:2
K @ jquery.js?ver=1.12.4:2
jquery.js?ver=1.12.4:4 GET https://portal.memorializeme.com/memorandum/getAllMemorialsName 0 ()

Please contact the creator of this script and ask more information about this error as we are note familiar with this code or how to resolve this error.

Thanks.

I will check with the developer and see if something changed on the portal side.

Thank you for your help.

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.