Auto refreshing pages on WordPress

Tweet Blender is a great plug-in for WordPress that allows to show relevant tweets that can be searched by user name, #hastags or keywords.  Apart from the widgets that can add twitter feeds to the sidebar there is an interesting archive page.  Last year during an event we wanted to show our website while the party developed and we encourage people to tweet about the party itself.  Main downside of the archive page is that is a standard, static page and in order to see updates you need to reload it (e.g. refresh it).

In order to make this page auto refreshing you can add a little script to the header so that when the archive page is displayed it gets reloaded every so often (in this specific case 30 seconds).  This piece of code must be added in the <head> section as follows:

<meta charset="<?php bloginfo( 'charset' ); ?>" />
if ( is_page_template( 'twitter-archive.php' ) ) 

 * enter refresh time in "minutes:seconds" Minutes should range 
 * from 0 to infinity. Seconds should range from 0 to 59
var limit="0:30"

if (document.images)
    var parselimit=limit.split(":")

function beginrefresh()
    if (!document.images)
    if (parselimit == 1)
        if (curmin != 0)
            curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
            curtime=cursec+" seconds left until page refresh!"



Leave a Reply

Your email address will not be published. Required fields are marked *