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:

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

<script>
<!--
/*
 * 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(":")
    parselimit=parselimit[0]*60+parselimit[1]*1
}

function beginrefresh()
{
    if (!document.images)
        return
    if (parselimit == 1)
        window.location.reload()
    else
    { 
        parselimit-=1
        curmin=Math.floor(parselimit/60)
        cursec=parselimit%60
        if (curmin != 0)
            curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
        else
            curtime=cursec+" seconds left until page refresh!"
        window.status=curtime

        setTimeout("beginrefresh()",1000)
    }
}

window.onload=beginrefresh
//-->
</script>
<?php
}
?>

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.