• Resolved ashop1

    (@ashop1)


    hello, hope to write in the right place ..
    It happens that I try to do everything and I search the internet for many websites but somehow I cannot make the javascript + jquery code of this example work: https://jsfiddle.net/bluntfakie/j5415gyg/

    nor from others that use the same javascript + jquery code

    I have some script codes added by me but I can’t with this

    I already tried in my .js folder of the child theme among other things.

    Could you tell me how to add that last code to make it work please?

    I suppose it is simple, I do not want to use any complement for that because I do not learn anything else. From already thank you very much

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    You need to enqueue your .js file in PHP with wp_enqueue_script(). Specify ['jquery'] as a dependency. And somehow include the related CSS into your site. You can add it to your child theme style.css, or enqueue a separate file with wp_enqueue_style().

    Call the PHP enqueue functions from a callback hooked to “wp_enqueue_scripts” action. The HTML can all be placed in a Custom HTML editor block.

    Note that WP jQuery runs in noConflict mode, so $ shortcuts do not work, use explicit jQuery instead, or use a “noConflict wrapper” (see my user note (second one) near the bottom of the above linked docs page.) Also, the WP jQuery version is currently 3.5.1. AFAIK the proffered jsfiddle code is still compatible.

    Thread Starter ashop1

    (@ashop1)

    Thank you very much for your answer, I will review it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add correctly JavaScript + jQuery 1.6.4’ is closed to new replies.