Add JS-Code in child-theme - by lens-scape

This topic has 2 replies, 2 voices, and was last updated 4 years, 11 months ago ago by Rose Tyler

  • Avatar: lens-scape
    lens-scape
    Participant
    December 13, 2019 at 01:42

    Hey,

    I am trying to add some js code to my website. I think the child theme is a good option, but it does not work.^^

    I tried this code in function.php of the child theme:

    function ah_custom_js_file() {
    // Enqueue a custom JS file with jQuery as a dependency
    wp_enqueue_script(‘custom-js’, get_stylesheet_directory_uri() . ‘js/custom.js’, array(‘jquery’), false, false);
    }
    add_action(‘wp_enqueue_scripts’, ‘ah_custom_js_file’);


    So i created a folder in the child theme for js and write my code into it.
    Unfortunately it does not work. At least an alert was initially recognized. But not anymore either.

    Maybe you can help or have a look?

    Would be nice,
    Regards

    Please, contact administrator
    for this information.
    1 Answer
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    December 13, 2019 at 11:56

    Hello,

    We’ve changed code in functions.php of your child theme. Please check.

    Regards

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.