Introduction to JavaScript in WordPress

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии • 48

  • @WPCasts
    @WPCasts  4 года назад +4

    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

    • @RajibAhmad
      @RajibAhmad 4 года назад

      Best one... U saved people lods of time... thanks :)

  • @dave28lax
    @dave28lax 4 года назад +4

    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.

    • @WPCasts
      @WPCasts  4 года назад +1

      Oh nuts! thanks for the tip.

  • @basenkoserhii
    @basenkoserhii 4 года назад

    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!

  • @dave28lax
    @dave28lax 4 года назад +3

    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.

    • @WPCasts
      @WPCasts  4 года назад +1

      Love these comments! Thank you

    • @wayneyallop8872
      @wayneyallop8872 3 года назад

      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?

  • @homercavazos
    @homercavazos 2 года назад

    Mind blown! Great explanation. Thank you.

  • @maxkirwin1474
    @maxkirwin1474 4 года назад +2

    Without fail, always clever, informative and to the point. Bravo 🚀

    • @WPCasts
      @WPCasts  4 года назад

      Much appreciated!

  • @hansschuijff
    @hansschuijff 3 года назад +1

    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.

  • @kellenmace
    @kellenmace 4 года назад

    Excellent overview of loading JS files in WordPress 👍🏼

  • @saberking7869
    @saberking7869 2 года назад

    Hi, thanks for the video, where can I find the files index.php, styles.css and functions.php? Thanks

  • @MobiusCoin
    @MobiusCoin 4 года назад +1

    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.

  • @HaifengZhu-pn3uq
    @HaifengZhu-pn3uq Год назад

    hi, apart from html, css, javascript and php, what other codes will be used in php development

  • @errorerror1337
    @errorerror1337 4 года назад +1

    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!

    • @matt526
      @matt526 4 года назад

      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?

    • @errorerror1337
      @errorerror1337 4 года назад +2

      @@matt526 Ah yes, a good point. And don't call me Shirley ✈️

  • @mattkiteley1
    @mattkiteley1 3 года назад

    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! :-)

  • @raj080288
    @raj080288 4 года назад +2

    What extension are you using for wordpress snippets on vscode?

    • @WPCasts
      @WPCasts  4 года назад +1

      this guy right here: marketplace.visualstudio.com/items?itemName=wordpresstoolbox.wordpress-toolbox

    • @raj080288
      @raj080288 4 года назад

      @@WPCasts thanks

  • @zealtypedcode3119
    @zealtypedcode3119 4 года назад

    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

  • @sestalacto
    @sestalacto 2 года назад

    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.

  • @litots5215
    @litots5215 2 года назад

    What theme are you using, mate?

  • @jaakkopontinen
    @jaakkopontinen 4 года назад

    9:15 Seen here, for example, you have the php block end on line 1, then on 3 you start with

  • @vladtircomnicu1630
    @vladtircomnicu1630 4 года назад

    Super useful info. Thank you!

  • @samirsamir7779
    @samirsamir7779 4 года назад

    great content as usually , thank you .

  • @alexlytle089
    @alexlytle089 4 года назад

    Perfect timing bro

    • @WPCasts
      @WPCasts  4 года назад +2

      A wizard is never late or early, he arrives precisely when he means to

  • @adnanamin3666
    @adnanamin3666 4 года назад +1

    Great and informative as always! 😍
    Is there any plan of making a series on WP theme development? That'd be great!

    • @WPCasts
      @WPCasts  4 года назад

      In the future, yeah. Not sure when, though.

  • @SridharKatakam
    @SridharKatakam 3 года назад

    Can you share the name of the VSCode theme you are using?

    • @WPCasts
      @WPCasts  3 года назад

      marketplace.visualstudio.com/items?itemName=GitHub.github-vscode-theme

  • @m44verick
    @m44verick 4 года назад

    Great tutorial, more like these, please! I like auto-completing. What editor are you using?

    • @WPCasts
      @WPCasts  4 года назад +2

      I'm using this one: marketplace.visualstudio.com/items?itemName=wordpresstoolbox.wordpress-toolbox

    • @WPCasts
      @WPCasts  4 года назад +1

      Oh and I'm using VSCode

  • @yanike
    @yanike 3 года назад

    Awesome!

  • @DevsLikeUs
    @DevsLikeUs 4 года назад

    Great video, thank you.

  • @malmahsyar3347
    @malmahsyar3347 3 года назад

    Thank you sensei

  • @rangabharath4253
    @rangabharath4253 4 года назад

    awesome

  • @umerayazbaig2025
    @umerayazbaig2025 4 года назад

    Got lost after 12:00 Mins.