Read my latest blog entry: Does your web site help, or hurt your business?.
Subscribe to my RSS Feed or by Email.
  • Home
  • About
  • Services
  • Blog
  • Contact
Christopher Ross Building better web sites, one pixel at a time.

How to Rotate Your Logo on Holidays.


Welcome to my blog, please feel free to subscribe to my RSS feed or leave a comment.

One of the most interesting things I see Google do regularly is change their logo to celebrate the holidays or mark a special day. It seems like a pretty labor intense operation but it’s actually a very simple thing to do with a little bit of PHP and it works great for WordPress blogs as well.

Now, the first thing you’d need to do in order to change your logo is store it in a specific folder and call it based on the day.

<img src=’/path/to/your/images/filename-<?php date(’Y-m-d’);?>.jpg’ alt=’logo for <?php date(’Y-m-d’);?>’/>

This example shows a very simple method to accomplish our goals here. It simply inserts the value for a date (in this case 2008-01-01) into the file name which will cause the server to load the image filename-2008-01-01.jpg from your web site. In theory this is all we need to do but … it means that you will have to save 365 versions of your logo per year and edit the ones that you want to make special which is time consuming. Let’s look at a better method for completing this objective.

We want to introduce the option of placing the standard logo on most days as a failsafe and only display the special logos on special days. To do this, we need to check if the file exists, otherwise fall back to the original.

<?php
if(file_exists(’/path/to/your/images/filename-’.date(’Y-m-d’).’.jpg’)) {
   $file = date(’Y-m-d’);
} else {
   $file = ’standard’;
}
?>

<img src=’/path/to/your/images/filename-<?php echo $file;?>.jpg’ alt=’logo for <?php date(’Y-m-d’);?>’/>

 

Now what we’ve done is called the file_exists function to ensure the logo filename-2008-01-01.jpg exists before showing it. If it doesn’t exist, it shows the logo filename-standard.jpg instead.

P. S. You may want to take a look at my tutorial on caching WordPress as this process will increase server load.

Other Posts of Interest

  • Adapting my holiday logo rotator for WordPress
  • Show both links and pictures in WordPress wp_list_bookmarks()
  • Automatically Title Casing Titles in WordPress
  • How to make awesome 3d icons in Adobe Fireworks
  • DOS attack brings down WordPress
  • How to center content with CSS and HTML
  • Reflective image effect in Adobe Fireworks
  • How to create a reflective web site image in Photoshop
  • Structuring your web site with Adobe Dreamweaver
  • Building your first Dreamweaver Template file
Posted on: Monday, October 20th, 2008
Tags: logo, php, tutorial
Posted in Learning | | Read more

Did you find this article useful? You're welcome to post a link to this website along with the title but please don't copy the whole article. You can also link back using the following code:

<a http://www.thisismyurl.com/tutorials/how-to-rotate-your-logo-on-holidays/" rel="bookmark" title="How to Rotate Your Logo on Holidays.">How to Rotate Your Logo on Holidays.</a>

About the Author

Christopher Ross About the author.
Thanks for taking the time to read my blog. If you don't already know me, my name is Christopher Ross and I'm a web evangelist living in Fredericton Canada. When I'm not writing about the Internet, I'm helping small businesses improve their search engine performance or building better WordPress web sites for clients.

Please feel free to leave a comment below, or contact me if you have any questions.

2 Comments

|
comments rss [?] | trackback uri [?]

2 Responses to “How to Rotate Your Logo on Holidays.”

  1. Internet Marketing Do-Follow Blog Says:
    October 22nd, 2008 at 1:59 am

    This is perfect, I was jsut thinking the other day about the holidays coming up and how to easily tweak some stuff on my sites.
    Thanks Chris!!!
    JR

  2. Pingback: Adapting my holiday logo rotator for WordPress :: Christopher Ross

Leave a Reply

TrackVia
PCSecurityShield
Amazon
TrackVia
iTunes
iTunes
iTunes - Pirates
PCSecurityShield
Amazon
Total Training DVDs
HBO
iTunes
Recent Comments
  • Donace: @ Christopher I agree wholeheartedly all they need is one page; possibly some nice pictures :p I’m like...
  • Electric cars: Very nice post and I gain much more info from this post about, “How to useful my site for my...
  • Internet Marketing Strategies: That is really bad business, with the Internet making the world such a small place,...
  • Adam Love: wtf, that was prety blunt don’t you think?
  • George Matthews: well that’s effective, know of an easy way of title casing static sites, other than...
  • Market Secrets Blogger: At first this one click plugin install worked just fine but now I get the following error:...
  • Rodney@Blogging with WordPress: Nice work Christopher - not too shabby. You must have some pretty good backlinks....
  • david forex trading online: Thank you for letting it slide. I know it is annoying when people use keywords as their...
  • Ikki at SEO Blog: As Mr. forex trading online (I hate it when people don’t put their names on the Name...
  • David: One more strategy of search engine marketing is to create a buzz about your site in the internet. This can be...
Top Commentators
  • rv for sale (8)
  • Internet Marketing Strate... (7)
  • Electric cars (6)
  • Ikki at SEO Blog (4)
  • forex trading online (4)
  • RNB Love Songs (4)
  • Make Money Online (3)
  • Donace (3)
  • Mike Collins (2)
  • PizzaForADream (2)
© Copyright 2009 Christopher Ross. All rights reserved.
  • Follow my posts:
  • RSS
  • Comments
  • Email
  • Other:
  • Privacy