Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Lester Chan

    (@gamerz)

    You have to modify the code:

    https://github.com/lesterchan/wp-postratings/blob/master/includes/postratings-scripts.php#L58

    
    wp_enqueue_script('wp-postratings', plugins_url('wp-postratings/js/postratings-js.js'); 
    

    With

    
    if ( is_single() ) {
    wp_enqueue_script('wp-postratings', plugins_url('wp-postratings/js/postratings-js.js'); 
    }
    
    Thread Starter amoozesh3.ir

    (@kama90)

    You’re a genius.it worked for me.

    Joe The Boss

    (@joe-the-boss)

    No is not a genius

    Bad idea to change code in plugin source files. What will happen after an update ? It will break everything…

    An other point, your plugin forces WP to load Jquery in wp_head…
    It is very bad ! You should not do that if you want your site to load fast !

    Please update your plugin or give possibility to users to put functions directly in their functions.php file

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to load js file only on single page?’ is closed to new replies.