Google is showing New Year countdown when you click on I am feeling lucky.
Here I am explaining, how to display the same countdown on Front Page of Your WordPress blog. To get started first you need to Install WordPress FrontPageBanner Plugin ( I have written this plugin to show banner and Google Adsense on WordPress FrontPage but when I have read Harsh’s post on Google CountDown, I thought why not use it for new year countdown). After the successful Installation of this plugin; you will see ‘FPB Settings’ menu item in Admin Panel, click on it. This is the configuration panel for this plugin.
Enable ‘Media’ as default style and PHP, and paste the following code in ‘Custom Code’.
<?php
//Insert this code in 'Custom Code' of WordPress FrontPage Banner plugin
/**/
//set the timezone, it will override your default server timezone settings
date_default_timezone_set('Asia/Kolkata'); //http://php.net/manual/en/timezones.php
//current time
$now = strtotime("now");
//1 Jan 2010
$new = strtotime("1 January 2010");
//get the difference
$diff = $new - $now;
?>
<!-- overriding your theme's style sheet, you can change the color and size accordingly -->
<h2 style="font-family: arial,sans-serif ;font-size: 200%; font-weight: bold; color: darkblue"; id='timer'></h2>
<script>
<!--
// javascript to show the timer
var count = <?php echo $diff."\n";?>
document.getElementById('timer').innerHTML = count--
function display()
{
if(count>=0)
document.getElementById('timer').innerHTML = count--
else
//show this message on 1 Jan 2010, change this messsage to whatever you want
document.getElementById('timer').innerHTML = "rcanblog wishing you a very Happy New Year"
//tick the counter for every second
setTimeout("display()",1000);
}
display();
-->
</script>

I have commented in code to explain what is happening, but if you need any more help feel free to comment on this post, below is the screen-shot as how it may look on your blog.
You can also download the code from this text file.

I’m sure many of you will love to add this plugin to welcome new year. Meanwhile Happy new year in advance.
This is a guest post by Ashish who writes at Rcanblog. If you like to write for Shoutmeloud, do read Shoutmeloud Revenue sharing program.
Subscribe Updates, Its FREE!




→
{ 10 comments… read them below or add one }
Interesting Discovery .. But I don’t use this
Appreciate you for your cool discovery!! But it looks quite odd over the blog… I think that readers will get confuse after seeing such an unknown mysterious digits above the blog post.
This is very cool and the plug in is nice… but this looks quite odd in the home page..
Nice one bro! Going to give it a try on my new blog. BTW post re-tweeted!
I rarely add plugin without any benefit as it can make my blog loading slowly. Thanks anyway
@Rajesh @Arijit @Ankit @Chethan
Thanks for appreciation
@Rajesh @Arijit
You can add some thing like “New Year Countdown” before the counter to let you visitors know what this tick is all about.
Nice cool to know… I bet many would like to get this for the new years 2010 count down gadget / widget.
The script seems pretty simple to use Thanks !
After google now wordpress. Good to see.
Happy New Year.
@Tinh
Don’t worry this plugin is neither using any database queries nor filters, so there will be no harm to your speed . It is same like configuring general options with WordPress.
Read more about this plugin @
http://rcanblog.com/tag/wpfpbhelpdocs/