• Hi,
    I have problems with my javascript. If I didn’t activate plugin, js working. When I activated the plugin, js is not working. How can I fix it?
    There is my code:

    function my_script_enqueue(){
    	wp_enqueue_style('custom_style', get_template_directory_uri() . '/css/style.css', array(), '1.0.0', 'all');
    	wp_enqueue_script( 'custom_script', get_template_directory_uri() . '/js/scripts.js', array ( 'jquery' ), 1.1, true);
    }
    
    add_action( 'wp_enqueue_scripts', 'my_script_enqueue');

Viewing 6 replies - 1 through 6 (of 6 total)
  • Please use different names or use a prefix for enqueue process like your_theme_name_style and your_theme_name_script i think it should work. It may not work due to conflict in name

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Then again, ” js is not working” does not indicate whether it’s being enqueued or not. Can you link to the page with the problem, or provide a more accurate description of the issue? Both would be best.

    Thread Starter 17Mark

    (@17mark)

    Hi, all scripts are included only aren’t working (see image in link). When I deactivate plugin, my scripts are working.
    I tried some other name of function and it still does not work.
    Image

    Can you check the console i think there might be some javascript error or something so the codes are not working ?

    Thread Starter 17Mark

    (@17mark)

    There are errors from console:
    imgur.com/Y5lVRAP

    I think the error is caused due to the conflict between prototype and jquery and you need to find a way to manage it 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Custom js and plugin js’ is closed to new replies.