Timeline for I want to enqueue a .js file to my child theme
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 20, 2019 at 14:21 | comment | added | NomanJaved |
the second method perfectly works for me by just changing custom-script to parent-script .
|
|
Dec 18, 2016 at 8:20 | comment | added | 0xh8h | Thanks for the part "get_template_directory_uri() will only work in a parent theme." It gives me headache for a couple of days | |
Feb 6, 2015 at 9:15 | comment | added | MrKainig | @BradDalton I added the function inside my existing add_action, but that did not work. When I copied the working example 1:1 beneath my existing add action it worked flawless. The post was updated once again. Thanks guys :) | |
Feb 6, 2015 at 9:10 | vote | accept | MrKainig | ||
Feb 5, 2015 at 12:43 | comment | added | Pieter Goosen | @MrKainig check in your browser console if your script is loading and if you get any jquery errors. Did you remove the script tags in your js file, as they should not be there. I cannot see that the code in this answer is not working for you. Your script should load. | |
Feb 5, 2015 at 12:28 | comment | added | Brad Dalton | What have you tested so far? The above examples are both tested and work. | |
Feb 5, 2015 at 12:27 | history | edited | Brad Dalton | CC BY-SA 3.0 |
added 151 characters in body
|
Feb 5, 2015 at 11:11 | comment | added | MrKainig | @BradDalton Well I tried that but it didn't work for me. Do I have to add a second "add action" or add a second "function" or configure the "add action" or configure the "function" There are so many possibilities. If someone could briefly explain me whats best practice - or what actually works - by showing me how to implement that working example in my existing code. That would be really awesome and save me a headache | |
Feb 5, 2015 at 10:43 | history | edited | Brad Dalton | CC BY-SA 3.0 |
added 30 characters in body
|
Feb 5, 2015 at 10:42 | comment | added | Brad Dalton | Its only a working example. Some work is required on your behalf to learn how it works with your code. You can now rework your code so it loads your scripts in your theme. | |
Feb 5, 2015 at 10:39 | comment | added | Pieter Goosen |
Yes, they do, but get_stylesheet_directory_uri() is faster :-)
|
|
Feb 5, 2015 at 10:37 | comment | added | MrKainig | I tried the first one, it didn't work. Can you maybe post the full code blog (including my existing & working enqueues)? Because I don't know how to properly implement your code with the one that's already in my functions.php | |
Feb 5, 2015 at 10:37 | comment | added | Brad Dalton | They both work based on my testing. | |
Feb 5, 2015 at 10:33 | comment | added | Pieter Goosen |
Why don't you use get_stylesheet_directory_uri() ?
|
|
Feb 5, 2015 at 10:30 | history | answered | Brad Dalton | CC BY-SA 3.0 |