Adding countdown to your theme using php

For theme designers sometimes #php is better than #shortcodes. So here i will show you how to easily add countdown widget to your theme file. You need to know some php to integrate it with your posts.

Just open appropriate template file and add this simple code:

<div class="countdown-container" style="width:250px; margin:0 auto;">
  $countdown = array(
	'title'		=> '',
	'event'		=> 'Event description here',
	'date'		=> '12 March 2011',
	'hour'		=> 16,
	'minutes'	=> 45,
	'seconds'	=> 0,
	'format'	=> 'yowdHMS',
	'link'		=> false, // set true to remove link, false to support me

  echo shailan_CountdownWidget_shortcode($countdown);

Change date, event title and format as needed.

And you are done.

date attribute here is really clever, it uses strtotime which can convert many string formats to date. You can easily integrate date using any of the formats supported. Read more about strtotime.

If you find this plugin useful consider donating a few bucks. Thanks.



Free Newsletter

Subscribe to our newsletter for awesome tips about Wordpress and Web Design
* = required field

powered by MailChimp!

Keywords Sponsorship

Powered by WordPress and Shailan