How do I add a simple jQuery script to WordPress?

后端 未结 18 1711
心在旅途
心在旅途 2020-11-22 16:53

I read the Codex and a few blog posts about using jQuery in WordPress, and its very frustrating. I\'ve got as far as loading jQuery in functions.php file, but a

18条回答
  •  抹茶落季
    2020-11-22 17:51

    You can use WordPress predefined function to add script file to WordPress plugin.

    wp_enqueue_script( 'script', plugins_url('js/demo_script.js', __FILE__), array('jquery'));
    

    Look at the post which helps you to understand that how easily you can implement jQuery and CSS in WordPress plugin.

提交回复
热议问题