• I am learning WordPress plugin development. Now I need to place jQuery code in one file. Where can I place jQuery code ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Typically, you’d put that code in a something.js file, which you’d enqueue with wp_enqueue_scripts. Make sure you set the dependency field to include jquery. If you need to pass values from PHP to the javascript, use wp_localize_script().

    Thread Starter abufoysal

    (@abufoysal)

    Thanks @sterndata. But where to put the Javascript file to export as zip file ? Thanks.

    • This reply was modified 4 years, 9 months ago by abufoysal.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘jQuery in WordPress Plugin’ is closed to new replies.