• Resolved Tche111

    (@tche111)


    Hi,

    I am using supersocializer on only two pages (login and register) but it is loading everywhere, consuming resources and making the site slower than needed.

    Trying to solve it I set :

    <?php
    if ( is_single() ) {
    	wp_dequeue_script('the_champ_ss_general_scripts');
    	wp_dequeue_style('the-champ-frontend-css');
    	}
    ?>

    in my header.php (just before wp_head) and
    – I unticked “load js in footer”
    – I unticked “activate social sharing”
    – I ticked “not load modernizer” in the social sharing

    following older topic on this forum, my intuition in the plugin options and what’s working for another plugin (contact-form7 is well documented). But it doesnt seem to work with supersocializer.

    I still have
    super-socializer/js/front/social_login/general.js (975B)
    super-socializer/js/front/social_login/google.js (835B)
    super-socializer/js/front/facebook/sdk.js (748B)
    super-socializer/js/front/social_login/facebook.js (416B)
    super-socializer/js/front/social_login/linkedin.js (310B)
    super-socializer/js/front/social_login/common.js (3.5KiB)
    Loading for no reason
    (example: https://bit.ly/1LzGZhG)

    I am probably doing something wrong, but I would happy if somebody could tell me what and would help me solving the issue.
    Many thanks in advance for your help
    Sincerely

    Tche

    https://www.ads-software.com/plugins/super-socializer/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Heateor Support

    (@heateor)

    Hi Tche,

    You just have to call above functions at right hook. Try following:

    function my_custom_scripts(){
    	if ( is_single() ) {
    		wp_dequeue_script('the_champ_ss_general_scripts');
    	        // more scripts to dequeue
            }
    }
    add_action('wp_enqueue_scripts', 'my_custom_scripts');

    We will improve this aspect of the plugin in upcoming releases.

    Thread Starter Tche111

    (@tche111)

    Hello,
    I set your code into my functions.php and took off mine from header.php… but it doesn’t seem to work. When I look into Pingdom and GTMetrix, js and css still appear. I reduced cachingtime but It didnt change much.
    Many thanks in advance for your help!
    Sincerely

    Plugin Author Heateor Support

    (@heateor)

    Okay. Try following:

    function my_custom_scripts(){
    	if ( is_single() ) {
    		wp_dequeue_script('the_champ_ss_general_scripts');
    	        // more scripts to dequeue
            }
    }
    add_action('wp_enqueue_scripts', 'my_custom_scripts', 100);

    Thread Starter Tche111

    (@tche111)

    Hi Team,
    I am sorry but it s not working. I pasted your code in functions.php and only that. Am I doing well?
    Reading some discussions on other plugins, I learned that it could not work because it is not loaded on the right time…
    What do you think,
    Many thanks in advance!

    Plugin Author Heateor Support

    (@heateor)

    This code is tested and working fine.
    Would you drop an email at support[at]heateor[dot]com so that we can help you out?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘only load js when necessary’ is closed to new replies.