Home Forums WoodMart support forum enqueue a javascript file

enqueue a javascript file

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #554237

    Jean Bon
    Participant

    Hi,

    Can you give me please the PHP code to put in functions.php of a child theme to enqueue a javascript file located in the child theme folder.

    I don’t want to use Custom JS feature from theme options because i want the code to be loaded into an external file, not inline.

    Thanks

    • This topic was modified 8 months, 2 weeks ago by Jean Bon.
    #554408

    Hung Pham
    Keymaster

    Hello Jean Bon,

    Thanks for reaching to us.

    You need to first dequeue the parent theme JS file and then enqueue your own from the child theme. But I suggest you not to override this way but simply add another JS file where you can write your code or use our Custom JS in Theme Settings.

    If you still want to do this, you will need to add a localization array as well. You can find how to do this in the file funcitons.php PHP function – woodmart_enqueue_scripts

    Regards,

Viewing 2 posts - 1 through 2 (of 2 total)