First off have a blessed Advent!
Eight years ago I decided to create my own Advent Wreath graphic instead of just using the normal animated gif that I had used previously. If you would like it for your own blog you can use the html code below. I will replace the graphic each week so that it correctly shows the number of candles that should be lit. On Christmas I will change it to another graphic I created for Christmastide.
<img src="http://www.splendoroftruth.com/curtjester/wp-content/uploads/Advent/curtjester_advent.gif" width="170" height="189" /> Update: The above was updated since quote marks were not translating correctly
Additionally underneath my Advent graphic on my left side I have code that does a Christmas countdown showing how many praying days left.
Below are both a JavaScript and PHP versions. For WordPress use the PHP version.
JavaScript Version
<!– Christmas Countdown – Jeff Miller–>
<script language=”JavaScript”>
function eventcount() {
var now = new Date();
var message = “”;
var event = new Date(“Dec 25 2013 00:00:01”);
var seconds = (event – now) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
if ( (days%1)<.5)
days++;
days = Math.round(days);
if (hours< 0 && hours >= -24)
message = “Merry Christmas; Christ is born!”;
else if (days > 0)
message = “Only “+days+” praying day”+ (days>1?’s’:”)+ ” till Christmas!”;
document.write(“
<p>”+message+”</p>
<p>”);
}
eventcount();
</script>
<!– End Christmas Countdown –>
PHP Versions
<?php function countdown( $event, $month, $day, $year ) { // subtract desired date from current date and give an answer in terms of days $remain = ceil( ( mktime( 0,0,0,$month,$day,$year ) - time() ) / 86400 ); // show the number of days left if( $remain > 0 ) { print "<p><strong>$remain</strong> more praying days until $event</p>"; } // if the event has arrived, say so! else { print "<p>$Merry Christmas; Christ is born!</p>"; } } // call the function countdown( "Christmas", 12, 25, 2013 ); ?>
- For a good omnibus post on Advent see Marcel LeJeune’s post.
- Jimmy Akin’s 10 Things You Need to Know About Advent
Note: PHP version is adapted from here.
6 comments
Thanks so much for this Jeff – just one problem: I can’t get Blogger to recognise either the graphic or the countdown…
What am I doing wrong?
Thank you, Jeff o’ mine — and a blessed Advent to you!
This doesn’t work on blogger. Can you help? Thanks!
Thanks for the wonderful Advent Wreath. However, this year’s code is not working. It won’t show an image on our home page. Last year’s “Rejoice” code works…but, that would be getting ahead of ourselves!
Is there a “tweak” I can make to help this year’s graphic? Thank you and a Blessed and Happy Advent to you!
Code updated since quote marks were mixed
Thanks again, Jeff – the wreath now appears but the countdown still won’t work… and I tried changing the quote marks but no joy…