1865f986755d91079dc6b084ae1a66bd

New Year CountDown on your WordPress Blog

by AKM on December 28, 2009

in Wordpress plugin

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.

Download code 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.

Related posts:

  1. New year 2010 Countdown With Google Search
  2. Happy New Year 2010 – Google’s Way !!
  3. Google countdown to 2009
  4. Google Buzz With share Count WordPress Plugin
  5. WordPress adsense plugin Whytodowork , insert adsense code anywhere in wordpress blog post
  6. 5 WordPress tutorials, 12 wordpress plugins and 3 Premium themes to enhance your WordPress blog
  7. No self ping WordPress plugin : Stop pinging your own Blog post
  8. Twitter Live blog wordpress plugin : Show your Tweets on your blog

Do you like this story?

Wpfreelancer

{ 10 comments… read them below or add one }

1 Chethan December 28, 2009 at 07:22

Interesting Discovery .. But I don’t use this

Reply

2 Arijit December 28, 2009 at 11:12

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.

Reply

3 Rajesh Kanuri @ TechCats December 28, 2009 at 13:48

This is very cool and the plug in is nice… but this looks quite odd in the home page..

Reply

4 Ankit December 28, 2009 at 15:54

Nice one bro! Going to give it a try on my new blog. BTW post re-tweeted! :)

Reply

5 Tinh December 28, 2009 at 19:10

I rarely add plugin without any benefit as it can make my blog loading slowly. Thanks anyway

Reply

6 akm December 28, 2009 at 23:33

@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.

Reply

7 STRAIGHTALK December 28, 2009 at 23:48

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 !

Reply

8 Abhi December 30, 2009 at 01:17

After google now wordpress. Good to see.

Reply

9 Nipul Parikh December 30, 2009 at 17:27

Happy New Year.

Reply

10 akm December 31, 2009 at 18:24

@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/

Reply

Leave a Comment

Previous post:

Next post:

ShoutMeLoud on Twitter ShoutMeLoud on Facebook ShoutMeLoud RSS Feed