Support » Plugins » How can I use jQuert In the Theme

  • Resolved njuptsoz

    (@njuptsoz)


    Hi everyone, I have some questions.

    1. how can I use the jQuery which is in the WordPress’ wp-include/js/jquery.js is there any function can use this file?
    2. when I use this jquery file,I can not use the function $, only can use jQuery, I don’t like it, I want to use $

    Any body can help me?
    Thanks advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • If you use $ you may accidentally be using Prototype. You can redefine jQuery to $j (for your own code) if that helps.

    And to use it in the Theme, just add a short <script> to your page header.php file. Or learn a bit of plugin programming and put an action hook to include your js file in the functions.php file in your theme’s directory. Look up wp_enqueue for details.

    Before your </head> type: <?php wp_print_scripts('jquery'); ?>

    Then you have to use jQuery(“#test”) instead of just $(“#test”)

    Thread Starter njuptsoz

    (@njuptsoz)

    Nice,thank you RogerTheriault and GameerZ. very much 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I use jQuert In the Theme’ is closed to new replies.