Lazy Widget Loader

Description

The Lazy Widget Loader plugin provides lazy loading for widgets to improve page loading. Use it on slow widgets, especially those where external data is loaded, like widgets from Facebook, Twitter, AdSense, …

What this plugin basically does is to postpone loading the content of those widgets you choose, so that their content is loaded after the main content of the page that is displayed.

You can choose which widgets should be loaded like that, by default the plugin does not “impose” itself on any widget. You may also choose to display a throbber while the content of a widget is loaded.

Advanced lazy loading integration

The Lazy Widget Loader can take advantage of the advanced asynchronous loading mechanism provided by the Itthinx LazyLoader for content and widgets. This plugin helps to optimize site speed by greatly improving page load time and bandwidth usage. Instead of deferred loading in the footer, it provides advanced options that allow to load any content only when needed. These include shortcodes that allow to lazy-load content anywhere on a page, the option to load content on sight and an automatic noscript feature that helps to provide alternative content for visitors that have disabled JavaScript. You can see a demo of the Itthinx LazyLoader here.

Documentation

36 Responses to Lazy Widget Loader

  1. William September 10, 2011 at 11:34 pm #

    Hi,

    Thanks for releasing the plugin, I tried and it worked as described except I am getting a error like below after I activated the plugin.

    Warning: Cannot use a scalar value as an array in /home/vichen18/sweethomemoms.com/wp-content/plugins/lazy-widget-loader/lazy-widget-loader.php on line 471

    The front end is running ok, this only showed up in the back end

    is there any thing we need to modify?

    • kento September 11, 2011 at 12:07 pm #

      Thanks for mentioning this William. Actually this is not an Error but a Warning.

      Sounds like somewhere $wp_registered_widget_controls[$id][‘params’][0] is turned into a scalar when it is supposed to be an array. I’ve already had another user reporting this (see http://wordpress.org/support/topic/plugin-lazy-widget-loader-conflict-with-widget-logic-and-work-around) and have checked if there is any conflict between Widget Logic and Lazy Widget Loader but could not reproduce the Warning, it doesn’t seem to be related to the order in which those two plugins are activated either. Both ways, on WP 3.2.1 with Widget Logic 0.48 and Lazy Widget Loader 1.1.0, I could not observe the Warning.

      Could you please post what other plugins you have currently installed (including version), along with your current WP version?

      • Mike September 16, 2011 at 3:13 pm #

        Has anyone figured this out? Maybe William can send you his list of plugins to see which ones we have in common. I deactivated my plugins one-by-one last night but couldn’t get the warning to go away. However, on my “test” WP installation, I’ve installed the same plugins and I can’t get the warning to appear at all! I’m stumped.

        • kento September 16, 2011 at 3:40 pm #

          Not yet, but I’ll be running tests later on and have additional information provided by others.

          • Mike September 17, 2011 at 4:01 am #

            Excellent, I’ll stay tuned for any updates. Thanks for checking into this!

            • kento September 17, 2011 at 6:35 pm #

              Mike I’d also like to thank you for contributing your time and efforts to this. I appreciate that very much, as it is important for users to get involved, that way you help to improve things and of course I do my part in taking the feedback to make sure that possible problems that arise are eventually solved. Win-win :)

    • kento September 20, 2011 at 10:45 pm #

      I’ve just released an update of the plugin (1.2.1) which should avoid any issues related to the warning reported.

  2. Steven Brady September 15, 2011 at 5:10 pm #

    I’m finding that when I enable Lazy Loading on my widgets, they shift to the left and don’t stay in the column where they’re supposed to be.

    Example: http://eatspress.com/~mariachi/?page_id=2

    I’ve included the same Facebook widget twice. First is properly aligned, doesn’t have Lazy Loading enabled. Second one does.

    Do you have any thoughts on fixing this?

    Thank you,
    Steven

    • kento September 15, 2011 at 6:06 pm #

      I’ve tested the plugin you are using and it works fine on a plain WP 3.2.1 (using the Twenty Eleven theme). But on your page, the HTML rendered for the two widgets is not the same, difficult to say what’s causing this without a closer look but this is what’s enclosing the Like Box: <widget class=”widget … and that’s obviously not correct HTML. Have you tried with the default theme?

      • Steven Brady September 15, 2011 at 6:15 pm #

        Bugger. Yes, it seems to work fine with the Twenty Eleven theme.

        • kento September 15, 2011 at 6:19 pm #

          Then I’d check with the theme developer, this shouldn’t be an issue.

          • Steven Brady September 15, 2011 at 6:50 pm #

            It’s an Artisteer generated theme. I’ll go ahead and post in their forums. However, since I’m not a CSS guy, I’ll ask … is there anything I can add to the CSS to somehow add padding into the LWL widgets?

            Thanks!

            • kento September 15, 2011 at 6:55 pm #

              I could take a quick look at the theme if you like.

          • Steven Brady September 15, 2011 at 7:04 pm #

            If you can send me an email, I can send you files or credentials. Thanks so much for your help.

      • Thomas Foy September 17, 2011 at 6:52 pm #

        Artisteer adds art-block before widget in the class like:

        class=”art-block widget widget_search” for the searchbox

        Lazy Widget Loader is still wrapping the widget, but stripping off the art-block part so it looks like:
        class=”widget widget_search”

        which may be why you are losing the css formatting. Perhaps there is a easy fix to add art-block to the php inside Lazy Widget Loader having it rewrite this back in the class tag.

        • kento September 17, 2011 at 7:03 pm #

          Thanks for your comment Thomas, actually they use a widget tag as a marker from what I have seen (look for before/after in code), but the marker still appears in the code after everyone’s done their thing, leaving the dreaded <widget> tag unchanged. Hmmm …

  3. Thomas Foy September 17, 2011 at 7:58 pm #

    Kento,

    Definitely one of the major drawbacks to using a program like Artisteer is that it does deviate a bit from the standards in it’s coding and bloats the code a some. This is a great plugin and I would love to see it working with Artisteer themes as well. If you ever want a theme to check out with the plugin let me know or I can install the plugin on a site with a Artisteer theme and give you access to mess around with it.

    • kento September 18, 2011 at 11:19 am #

      Thanks Thomas, I’ve already taken a look and this is what I find in sidebars.php:

      if (function_exists('register_sidebar')) {

      $theme_widget_args = array(
      'before_widget' => '',
      'before_title' => '',
      'after_title' => '',
      'after_widget' => ''
      );

      And in theme_get_dynamic_sidebar_data($name) they use it to extract class, id and title. As I see it, they assume that no other plugins may do things to code in widgets, but that assumption is wrong. From what I see, unless the way they handle this there’s a good chance of conflict with a good amount of plugins.

      • Thomas Foy September 18, 2011 at 12:29 pm #

        Kento,

        So I can better understand, is the Lazy Widget Loader moving the widgets to the footer until after the page is loading then moving them back to the sidebar? Also is it artisteer or Lazy Loader removing the art-block from the class file and would it not be possible to add this somewhere in the code to be rewritten to the class tag.

        Thanks for all your help.

        Is your number captcha a wordpress plugin. I like the simplicity of it.

        • kento September 18, 2011 at 7:04 pm #

          Hi Thomas, to your first question: Lazy Widget Loader renders the selected widgets in the footer. When the onload/load event occurs, their content is moved to where it should appear.

          Lazy Widget Loader does not transform or modify the widget’s content. It simply adds a wrapper around the widget to act as a placeholder and provide extra options like the throbber or dimensions – but it’s not the loader that removes e.g. art-block.

          The captcha plugin is available here: http://wordpress.org/extend/plugins/captcha – the authors bestwebsoft did a nice job :)

          • Thomas Foy September 19, 2011 at 4:39 pm #

            Thanks Kento,

            Maybe someone from the Artisteer forum can shed some light on this then as to where the change occurs.

  4. Laurent September 18, 2011 at 1:25 pm #

    I get another error message :

    Invalid Content for CSS :
    – High impact
    – Easy to solve

    Issue Summary :
    The resource at this URL is not a CSS file. However it was referenced from another resource as a CSS file either using a tag or an @import directive. This is usually caused when the CSS file is missing and the web server instead returns an error page or another resource which is not a valid CSS file.

    Affected URLs :

    http://www.oreille-malade.com/wp-content/plugins/lazy-widget-loader/css/lwl-widget-css.php

    Thanks for your help,
    Laurent

  5. Martin May 31, 2012 at 6:26 am #

    Hey Kento,

    I am having problems with the Widget Loader on SSL pages. Not sure why but the jQuery ends up being a mess I think. I have deactivated the plugin now. But maybe you have an idea, what the cause of this may be.

    Cheers.

    • kento June 3, 2012 at 10:40 am #

      Hi Martin,
      I’d have to try it out to see the cause, if you let me know on what page and with what widget that happens, I’ll try to have a look.
      Cheers

  6. Ahmad November 14, 2012 at 10:36 am #

    amazing plugin thanks so much for sharing

    • kento November 14, 2012 at 11:30 pm #

      Hey thanks, nice to hear that :)

  7. Jon January 5, 2013 at 2:22 pm #

    Hi,
    I have tried your lazy loader at our Redooce.com website as it is really slow loading the twitter and FB follow info (code pasted into a text box widget), but instead of loading the text/social widget last, we just get the throbber all the time and the widget never loads.

    Please could you help us as we are trying to speed up page load ime and think your plugins could solve this issue for us if we can get them to work.
    thanks

    • kento January 7, 2013 at 10:23 am #

      Can you please post the code pasted into a text box widget and what widget settings you are using? Also which other plugins are active and what theme are you using please?

  8. Erik January 14, 2013 at 4:47 pm #

    Hello Kento!

    Very nice plugin, I have just briefly tested it and it seems to work smoothly. Only one problem sofar, the upper admin menu that is displayed when you are logged in to the site disappears.. any idea about reasons behind this phenomenom?

    Best regards,
    Erik

    • kento January 17, 2013 at 10:36 am #

      Probably a conflict with another plugin. It doesn’t happen normally.

  9. Arnaud March 7, 2013 at 5:47 am #

    Hi,
    this is really a GREAT plugin I love !

    I have just realize that I have a Javascript error on my site and I can’t fix it.

    I got this error : TypeError: ‘null’ is not an object (evaluating ‘widget_container.parentNode’)

    the plugin seems to work but this error is annoying

    http://www.concertsenboite.fr

    • kento March 9, 2013 at 12:07 pm #

      Thanks so much Arnaud :)
      Regarding the error, do you know what widget is producing it? It seems an additional check that widget_container is not null would be in place, but I’m wondering in what context it happens, as I’ve not seen that happen before.

  10. Arnaud March 13, 2013 at 3:03 pm #

    Hi Kento,

    Once I got one widget in lazy mode, I got this mistake ! But this is working by the way. This is just intellectually annoying.

    I also see that my lazy mode for image isn’t working.

    • kento March 19, 2013 at 9:15 am #

      Ok thanks, it’s probably best to just guard against that case then.

Leave a Reply