• Resolved kevin

    (@k-win)


    I’m trying to prevent the plugin from loading the js files by using define('WPSOCIALITE_LOADSCRIPTS', false); in the wp-config file as said in the faq but this does not prevent from loading the wpsocialite.js that tries anyway to setup the plugin by calling Socialite.process() and therefore creating an Uncaught ReferenceError: Socialite is not defined in the Chrome inspector.

    http://wordpress.org/plugins/wpsocialite/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tom Morton

    (@tm3909)

    Kevin,

    Thank you for bringing that to my attention. The issue was with the wpsocialite_localize_script function. It was loading a call to localize Socialite even though we were trying to disable it from loading.

    I wrapped the output of this function in an if/else statement that will check if the scripts are disabled. A release is hopefully coming this week, but if you need this solved now open wpsocialite.php in the wpsocialite plugin folder and find line 120:

    echo "<script type=\"text/javascript\">Socialite.setup({facebook:{lang:'$fb_locale',appId:null},twitter:{lang:'$tw_locale'},googleplus:{lang:'$gp_locale'},vkontakte:{apiId:'".get_option('wpsocialite_vkontakte_apiId')."'}});</script>";

    Replace it with the following:

    if( WPSOCIALITE_LOADSCRIPTS && !is_admin() ) {
                    echo "<script type=\"text/javascript\">Socialite.setup({facebook:{lang:'$fb_locale',appId:null},twitter:{lang:'$tw_locale'},googleplus:{lang:'$gp_locale'},vkontakte:{apiId:'".get_option('wpsocialite_vkontakte_apiId')."'}});</script>";
                }

    Let me know if this works for you and thanks for using WPSocialite!

    Thread Starter kevin

    (@k-win)

    Tom, when do you plan do publish the next release? My goal is to only load those files wpsocialite.js and socialite.min.js in the blog main page and on single posts. Do you plan to support that as well or will it require further coding? (not that i’m afraid of doing those if statements).

    Thanks

    Plugin Author Tom Morton

    (@tm3909)

    Kevin,

    Just pushed an update. Look for version 2.4 that has this fixed.

    Thread Starter kevin

    (@k-win)

    Hey Tom, just updated the plugin and even if i’m selecting “Apply to Single only” in the admin and deactivate the two lines in wp-config.php:

    //define('WPSOCIALITE_LOADSCRIPTS', false);
    //define('WPSOCIALITE_LOADSTYLES', false);

    It does load all the files on the home page; wpsocialite.css, wpsocialite.js and socialite.min.js.

    If i uncomment both lines, well scripts and css dont load at all.

    Am i missing something with this 2.4 release or is it on purpose so i let define('WPSOCIALITE_LOADSCRIPTS', false); and load both js files manually? (Which is is fine for me)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Uncaught ReferenceError’ is closed to new replies.