hey, thanks for good work here, finally got it clear with script localization. Small note - If I am not mistaken is_home() works both for the front page and blog home page, while is_front_page works only for the page that set to be home page in WordPress settings. Just my 2 cents. Cheers!
Thought this would be useful for something I am working on, so I actually read the docs, and I thought you might like to know that they say that best practice is to use wp_add_inline_script: "Though localization is the primary use, it was often used to pass generic data from PHP to JavaScript, because it was originally the only official way to do that. wp_add_inline_script() was introduced in WordPress Version 4.5, and is now the best practice for that use case. `wp_localize_script()` should only be used when you actually want to localize strings." Other than that it was a useful video.
Good shout! Would like to see a video where wp_add_inline_script() is shown being used as I'm struggling to get slide.js working without injecting the initialization in the footer. Or am I totally off point?
Ahh, I feel so smart when I know and use everything in one of these videos! 😁 Still very informative though! This was months of learning and scouring the internet in one convenient video.
Great vid, thank you for posting. Better to use get_template_directory_uri() though, since it will get the root of your theme. If the stylesheet is further down in the tree then you're locked in and can't navigate further up into the theme root if necessary. Thank you again, really great content man!
Surely the function being used depends on whether you're using a child theme or not? get_stylesheet_directory_uri() will return the current theme URI, whilst get_template_directory_uri() will get the parent theme URI, right?
Struggling to get this working. When I change my functions.php file (assuming it's the functions.php file in directory "wp_content/themes/sela" (sela is the theme I'm using)) to include the wp_enqueue_scripts action/function... I just get an error saying the website has encountered a critical error. I'm also using the Custom CSS and JS plugin, but I don't see how to associate a custom script with a particular page. Any tips/advice very much welcome! :-)
what do I need to learn exactly in JavaScript as WordPress developer just basics and jQuery for example or I need to learn more like es6 or typescript ?? thx a lot for all your informative videos am a self taught and I get inspired by all your tutorials
I hope you enjoyed the video. Make sure to follow me on Twitter if you want to chat or have video suggestions: twitter.com/AlexanderBYoung
Best one... U saved people lods of time... thanks :)
Never seen anyone try to create a file with blah/blah.js - and it does work, IF you do New File, and not New Folder as you did.
Oh nuts! thanks for the tip.
hey, thanks for good work here, finally got it clear with script localization. Small note - If I am not mistaken is_home() works both for the front page and blog home page, while is_front_page works only for the page that set to be home page in WordPress settings. Just my 2 cents. Cheers!
Thought this would be useful for something I am working on, so I actually read the docs, and I thought you might like to know that they say that best practice is to use wp_add_inline_script:
"Though localization is the primary use, it was often used to pass generic data from PHP to JavaScript, because it was originally the only official way to do that. wp_add_inline_script() was introduced in WordPress Version 4.5, and is now the best practice for that use case. `wp_localize_script()` should only be used when you actually want to localize strings."
Other than that it was a useful video.
Love these comments! Thank you
Good shout!
Would like to see a video where wp_add_inline_script() is shown being used as I'm struggling to get slide.js working without injecting the initialization in the footer. Or am I totally off point?
Mind blown! Great explanation. Thank you.
Without fail, always clever, informative and to the point. Bravo 🚀
Much appreciated!
The trick with craating a folder and file at the same time works. But you need to select new file instead of new folder like you did.
Excellent overview of loading JS files in WordPress 👍🏼
Hi, thanks for the video, where can I find the files index.php, styles.css and functions.php? Thanks
Ahh, I feel so smart when I know and use everything in one of these videos! 😁 Still very informative though! This was months of learning and scouring the internet in one convenient video.
hi, apart from html, css, javascript and php, what other codes will be used in php development
Great vid, thank you for posting. Better to use get_template_directory_uri() though, since it will get the root of your theme. If the stylesheet is further down in the tree then you're locked in and can't navigate further up into the theme root if necessary. Thank you again, really great content man!
Surely the function being used depends on whether you're using a child theme or not? get_stylesheet_directory_uri() will return the current theme URI, whilst get_template_directory_uri() will get the parent theme URI, right?
@@matt526 Ah yes, a good point. And don't call me Shirley ✈️
Struggling to get this working. When I change my functions.php file (assuming it's the functions.php file in directory "wp_content/themes/sela" (sela is the theme I'm using)) to include the wp_enqueue_scripts action/function... I just get an error saying the website has encountered a critical error.
I'm also using the Custom CSS and JS plugin, but I don't see how to associate a custom script with a particular page.
Any tips/advice very much welcome! :-)
What extension are you using for wordpress snippets on vscode?
this guy right here: marketplace.visualstudio.com/items?itemName=wordpresstoolbox.wordpress-toolbox
@@WPCasts thanks
what do I need to learn exactly in JavaScript as WordPress developer just basics and jQuery for example or I need to learn more like es6 or typescript ?? thx a lot for all your informative videos am a self taught and I get inspired by all your tutorials
Hi, I'm trying to do this with WP Coder v. 2.5.3 ( to create js scripts) and Snippets (for php scripts) but I am not being able to make it work.
What theme are you using, mate?
9:15 Seen here, for example, you have the php block end on line 1, then on 3 you start with
"
@@dave28lax thanks! I don't think I'll use it.
Super useful info. Thank you!
great content as usually , thank you .
Perfect timing bro
A wizard is never late or early, he arrives precisely when he means to
Great and informative as always! 😍
Is there any plan of making a series on WP theme development? That'd be great!
In the future, yeah. Not sure when, though.
Can you share the name of the VSCode theme you are using?
marketplace.visualstudio.com/items?itemName=GitHub.github-vscode-theme
Great tutorial, more like these, please! I like auto-completing. What editor are you using?
I'm using this one: marketplace.visualstudio.com/items?itemName=wordpresstoolbox.wordpress-toolbox
Oh and I'm using VSCode
Awesome!
Great video, thank you.
Thank you sensei
awesome
Got lost after 12:00 Mins.