• Unfortunately I used a plugin to create a child theme as I am struggling with the enqueue part in functions.php and I hope to do it on my own.

    I have the theme name, template, uri etc.

    After creating the child theme with the plugin I am trying to copy the theme js (which is loaded from the theme’s CDN rather than my server) to the child theme.

    I created a js folder, copied the js fie with the same name (added ?ver=) but it is not loading at all and the theme’s js is still loading.

    The theme’s author’s support is very limited due to covid19. This is the url of the js file I wish to load from the child theme:

    ppt1080.b-cdn.net/js/js.custom.js?v=10.8.7

    Thank in advance. I am using the latest version of wordpress, php 8.

    • This topic was modified 2 years, 4 months ago by Dan14.
Viewing 2 replies - 1 through 2 (of 2 total)
  • I’d try copying the functions.php to your child theme and replacing thesrc parameter of the wp_enqueue_script of that script, so it points to your local file.

    If you don’t want to do that, you can deregister their script using wp_deregister_script and enqueue your local file using wp_enqueue_script.

    • This reply was modified 2 years, 4 months ago by luisherranz.

    A child theme should call the old functions.php file first. You shouldn’t have to move it. The only reason for adding another functions.php file would be to override or add new functionality to the child theme. A child theme calls the old functions.php then the new one in the child theme. If it is enqueued in the parent theme you fine. If not you need to add a functions.php file to your child and enqueue it there.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Copying theme js to child theme’ is closed to new replies.