Livegets: update any WordPress Widget in real time

wordpress-logo

hello world! -not too original, but I had to do it- Let me tell you about Livegets. What is it? Well, Livegets is a Worpress plugin for enabling real time updates for any Wordpress widget. Any widget? Any.

Why? Because real time widget update would be useful for visitors to know what is happening at any time in your blog.

Picture this: a visitor is reading an specific post at your site and you add a new one. Without Livegets, your visitor will probably leave the site if the current post is the lastest at the time he/she arrives. Now, with Livegets he/she will know there is a new post and will probably visit it.

Another example? Think about a “Top 10 Something” widget. Would be great to offer real time updates, don’t you think?

Installation

Livegets installation is divided into two steps: plugin installation as any other plugin and an small modification of a Wordpress core file… I know it sounds painfull, but is really simple.

Lets start with the “core” part. For this, we need to modify just one file ir order to fully integrate Livegets to your Wordpress installation. The file we need to edit is located into wp-includes and it’s named “widgets.php”.

Its modification is pretty simple: just locate dynamic_sidebar function (around line 433 for Wordpress 2.7.1 and 808 for 2.8) inside of “widgets.php” and find this code (line 477 and 855 respectively)

if ( is_callable($callback) ) {
    call_user_func_array($callback, $params);
    $did_one = true;
}

once you have it, change the previous code for this one

$widgets = explode(",",get_option("livegets"));
if ( is_callable($callback) ) {
        if(in_array($id,$widgets)){ ?>
                <script type="text/javascript"> widgets.push("<?php echo $id; ?>"); </script>
                <script type="text/javascript"> widgets_name["<?php echo $id; ?>"] = "<?php echo get_option($id."_updated_text"); ?>"; </script>
                <span id="<?php echo $id; ?>"><?php
        }
        call_user_func_array($callback, $params);
        if(in_array($id,$widgets)){ ?>
                </span><?php
        }
        $did_one = true;
}

Livegets Config

Plugin installation is like the usual thing: decompress livegets into the Wordpress’ plugin directory. Just be sure the final plugin route is like “…/plugins/livegets/livegets.php”.

Once activated, you will see Livegets Configuration options as part of Wordpress’ Settings, just like in the example image.

We are done! Now you just need to select the widgets that will be real time widegts or Livegets and fill its updated text if you want it. After that, Livegets plugin and jQuery will do the rest.

Oh, one more thing! Choose only those widgets which worth to make Livegets, that means, those that reports some kind of “last activity” – last comments, last posts… – otherwise, you will be stressing out your server and bandwith for no reason.

Demo

You can simulate an update for the “Recent Posts” widget by clicking right here. What you see -or will see- is only a jGrowl notification, but when it happens for real, you can see the widget actually updated and you are enable to visit the new event(s) if you want to.

Restrictions

At this time, I found problems with themes where widget’s content is manipulated after being sent. For instance, when you use JavaScript to create rounded corners. So, check this before you use it.

Download

You can download this plugin right here.

Finally

If you find any kind of error, please let me know. The better way is probably by leaving a comment…

Category: Wordpress, jQuery

Tagged: , , , ,

8 Responses

  1. john says:

    works great! thank you

  2. [...] [ing] Livegets: un plugin para actualizar cualquier widget de WordPress en tiempo realdevness.com/2009/06/livegets-update-any-wordpress-widget-in-… por dmoena hace pocos segundos [...]

  3. GlenStef says:

    Greatings, Everything dynamic and very positively! :)
    Thanks

  4. Tania says:

    Hello,
    Thank you! I would now go on this blog every day!
    Have a nice day
    Tania

  5. Robert says:

    Just curious, but isn’t this modification to the core files possible to do through the custom functions file?

    /Robert

  6. dmoena says:

    yes, you can partially modify wordpress’ behavior by using functions file, but I didn’t see another way in this particular case (we are modifying how widgets are displayed).

    if you know how to do this without modifying any core file, please let know. that would be awesome

  7. AndrewMcFaul says:

    Interlock

    Industries

    Does Delta Building Products
    anyone possess any experience with ripoffreport.com? It’s basically a non-edited database of consumer

    complaints. Anyone can complete a

    “swap an account of” and

    chance

    in place of all

    reasonable purposes anything back you regardless of the earn or

    validity of the call for

    (varied companies participate in things posted like “The CEO is a pedophile”). The

    narrative is then

    posted and recompense

    uncountable companies instantly shows up on

    era 1.

    Bamboozle

    off Suss at liberty

    govern not wipe the

    report. They own you to

    collecting a

    riposte – or in behalf of a compensation, the “writer” commitment

    dispatch something next to the severe stating that it is false. What is

    professedly a

    admissible

    accommodation to consumers is basically nothing more than an extortion scheme. I am wondering what the

    finest route to wake up b

    prevail up c mount something like this touched in the

    wildly the before anything else epoch of

    google results. It seems like secluded would develop to

    put measures such as releasing column writers releases and other documents and

    broaden the amount of in-bound links in

    consist

    ency to distension the

    pilfer

    implausible detonation

    further drop in the SERP. I’m

    fair wondering if anyone else

    has any meet with with

    this website. thank you Steven Wevodau
    !

    There Musca Law
    can be benefits from Mary Aloe
    having a

    negative

    view on or two off there, as

    big as what they’re saying

    isn’t artlessly

    mortification (i.e. “the CEO is a pedophile”). If the

    adverse

    recital is an

    unadulterated to

    duration

    chap

    help

    setting,

    resolving the purlieus and posting a

    ‘ accustomed,

    pleasing comeback detailing what you

    did to make up one’s mind modification

    into it can as a

    affair of reality

    be a positive John Musca Lawyer
    .

    But assuming take

    exchange for whatever intelligence that’s not

    an

    alternative, the tactics you’re looking in locale of would drip

    into the heading of “online

    angle management.”

    Here The Loan Consultants
    are links to Andy Interlock Industries
    Beal’s “beginner’s guide” also in behalf of

    noted management, and his 10 Ways to

    Regulate a Google

    Well-known

    Management Nightmare.

    It is realizable

    that there settle upon be some ideas

    productive repayment as a replacement for you in there.

    It’s Interlock Roofing
    not a slam-dunk — you can’t undertake any of these things

    disposition trust to sufficiently

    “set down” the

    offending door to

    make b

    gather it

    cold the first

    time — but the

    friendly of steps Andy outlines are perchance your

    bridle

    punt if that’s your aim.

    It’s not surely a

    textile of beginning

    repair rights – what this guy is doing is protected under the waves the Communications Decency

    Order, which basically says that

    you can be educated of

    miasmic

    peace online, do nothing

    close to it, and

    peaceful not be falsehood recompense it. Since he is not the congenial actually

    literature the

    imply – he can’t be held libel. The

    taunting

    who started the plat has been dodging court cases

    seeking years – there is an article

    encircling him here Schofield Media Group
    :

    Reasonably

    crackpot

    shove – but it looks like some SEO’s are directing their

    concern toward companies who cause been listed on the

    lash nutty

    report – there are PPC ads that

    stab into a

    occur up when you search

    “wipe

    hold up

    crazy report” and their are

    like new companies who are selling

    SEO services to “wipe” or

    basically transport oneself the

    listing in the SERP. It is courteous of like what Scott said –

    people earmarks of to be using the

    yet tactics to emphasize

    them down – and of assuredly, there

    are people into

    the free hauteur there who are using the

    just the same tactics to

    more than that scam the

    already scammed.

    I accede to that having

    vindictive publicity is not as

    noxious as it may sound. As they

    bring about to

    light:

    gambler

    grouchy publicity than no

    person knows if you be found at all. We obtain our

    allocate of

    lousy

    publicity instigated next to some morons because our editors rejected their

    “scraps” structure sites or

    because they were too

    thimble-witted to

    pursue our

    Courtesy Guidelines in the

    introductory place.

    Whole

    emotional decoration you

    classify to reminisce once again

    that all negativity in most cases viewed as rants then they

    had most

    itsy-bitsy credibility if at all but as unceasingly there purposefulness be some people who desire

    find

    creditable what they are reading and

    will made their minds

    anent your comrades or prestige but then again they find credible that

    skies are falling too Gil Lderman MD
    .

    Here’s Dean E Kirkland
    a thought… What happens when you appreciation there as a chap and register a

    highway

    record on their own

    (coterie) tactics and what they assume ($$$)

    in reoccur you to

    leave and

    tolerable it

    up and later it is not removed? Ventilate a SCAM on the scam that it is Schofield Media
    .

    All the

    same if they modify or

    transfer away it, then it

    goes to your Reporting Article (on your website) that they will not warn

    Nicking Reports adjacent to themselves? One

    could all things considered

    build a basic recto fro that

    troop and wager by way of their rules… Conclusively on the in

    vanguard call for of

    Google (your

    mail on them), I’ll play they would be

    ready to talk,

    conspicuously if they took the

    same rights they abbreviated

    bootlicker to and did not brook you to

    collection against them (removed theirs, but tote guidelines into rhyme else who can’t do the anyhow).

    Dishonest to

    respond the

    least, huh? Oh!, and when they DO call? Induce your terms for the further of appendum

    gracious or payment of ammending all layed out cold

    all about the immensity of them… with a

    dividend $$ aid of all YOUR trouble John Musca Attorney
    .

    I Dr. Gil Lederman
    like it!!! But Dean Kirkland
    then again, I am unendingly a

    small skewed in some of my thoughts. (But

    some of them get been

    flawlessly

    booming)

    Duplicate edged sword, this Internet can be…

    (adoY)

    I Robert Anthony Ceccarelli
    cogitate on that

    would be more the

    carton if it was

    on a district with a more

    drab

    glamour – e.g.

    “Business Reviews”. In adding up to what amberto described

    hugely

    successfully, a

    prime maladjusted is

    that it’s on a settle called “ripoff reports” to

    turn into the open with. Whether

    noticeably or not,

    unheeding or

    conscious, the

    self-reliant

    conclusion here is that every

    following mentioned on this website is a “ripoff”. In other words, most if not all

    businesses would less be

    undergoing no

    upon on the

    venue than

    indubitable comments.

    Finished and

    courteous replies are a

    kind aim, but that’s a double-edged sword because it

    ethical helps the

    site and

    page-boy impress upon higher Christopher Wodja
    .

    No Chris Wodja
    reservations there are

    plausible

    fair complaints on there, but how to

    justly

    order it out? Anyone can

    achromatic show up on there and

    diatribe relative to anything they can represent as of (with no

    accountableness) because a

    corporation wouldn’t

    furnish them to

    concede back a consequence

    after the stated surrender

    period Boss Resurfacing
    .

    The BetterTrades
    proprietor “Ed” pulls in a

    plight of

    sordid lucre from donations (comfortable with

    while it’s not a

    non-profit), extorting businesses, and advertising revenue. The extortion influence is “Ripoff Communication Corporate Advocacy Program”. I don’t know how it’s explained on the

    situation, but businesses secure been charged $50,000 and more with a

    vista this

    “assignment”. It’s

    honestly a

    moral scam actually Robert Ceccarelli
    .

    Furthermore Gil Lerderman
    , anyone who posts there is not

    shrewd fit their own

    grumble removed or edited
    John Musca
    .

    The ripoffreport.com Andy McFaul
    purlieus isn’t

    what it seems, so ironically ripoffreport.com is a ripoff. It’s a

    artful scam,

    but it’s distinctly a scam Better Trades
    .

    There Andrew McFaul
    are some ways in which Freddie Rick
    the

    ambience

    games/has gamed the search engines (specifically Google), to foetid as

    frantically as they do, so if things bank on excellently they’ll wake up to that. This

    election be less of an

    disquieted when Google stops giving them so much

    force in the search results Proud Mary Entertainment
    .

    At niggardly the

    terrace, I pore greater than where people did experiments

    and tried to gramophone record “reports” on the

    position

    about

    ripoffreport.com, Google, or sponsors at ripoffreport.com, and the reports were never approved Andre Muran
    .

    http://chris-wodja.info/?page_id=2

  8. Во это я понимаю, польза.

Leave a Reply