• I have create a test web site on my pc and I need to add extra code to show an AI example.
    I have HTML code and js file as script. js files are realted to ai, not style or something similar. I don’t know how to allow wordpress to find my jsfile. I have tried modifing functions.php inside the Theme folder, according to the documentation, and other way but always the answer is file not found.
    Someone could help me?

    • This topic was modified 3 years, 4 months ago by Steven Stern (sterndata).
    • This topic was modified 3 years, 4 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @fabrimillo

    Try like this

    function wpdocs_theme_name_scripts() {
      wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
    }
    add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

    Home this will solve your issue, and let me know if it’s work

    Thanks

    Thread Starter fabrimillo

    (@fabrimillo)

    Thanks a lot for your quick reply. The script is an AI and not a style upgrade,, but what is not clear for me is what I should specify as src into the following script:
    <script src=”webcam.js”></script>, because just writing webcam.js it does’nt work. Also writing ./js/webcam.js, where js is the folder in theme directory where I have put the js file.
    I will thank a lot you if you let me know.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘jsfile in a custom html code’ is closed to new replies.