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.

Adapting My Holiday Logo Rotator for WordPress


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

The other day I wrote a tutorial on how to rotate your logo on holidays and since then I’ve had a few people email me and ask how to this specifically for WordPress using the standard Themes structure. In order to accomplish this for WordPress specific blogs, you’ll need to make a few minor changes to my original code.

First, you’ll need to know the path to your template directly. Luckily, WordPress provides easy access to that using the bloginfo(’stylesheet_directory’) variable. Now, to make your WordPress web site display a different logo depending on the day of the year all you need to do is edit the code from my earlier tutorial like so:

<?php
if(file_exists($_SERVER[DOCUMENT_ROOT].’/’.bloginfo(’stylesheet_directory’).’images/filename-’.date(’Y-m-d’).’.jpg’)) {
   $file = date(’Y-m-d’);
} else {
   $file = ’standard’;
}
?>

<img src=’<?php echo get_option(’home’)."/".bloginfo(’stylesheet_directory’)."/images/filename-".$file;?>.jpg’ alt=’logo for <?php date(’Y-m-d’);?>’/>

You’ll notice that I’ve introduced the

$_SERVER[DOCUMENT_ROOT]

variable which detects the server path of your WordPress installation and automatically inserts it into your query. If you’re using this technique, please let me know with a comment below.

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

  • Automatically Title Casing Titles in WordPress
  • Show both links and pictures in WordPress wp_list_bookmarks()
  • How to rotate your logo on holidays.
  • Blog Roundup for the 29th of September 2008
  • Sick Riot Photography
  • Blog Roundup for the 6th of September 2008
  • How do you install WordPress Plugins?
  • Fundraising Thermometer Plugin for Wordpress
  • Add a Digg button to your WordPress web site
  • Using WordPress to manage your web site
Posted on: Friday, October 24th, 2008
Tags: logo, php, WordPress
Posted in Learning, WordPress | | 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/wordpress/adapting-my-holiday-logo-rotator-for-wordpress/" rel="bookmark" title="Adapting My Holiday Logo Rotator for WordPress">Adapting My Holiday Logo Rotator for WordPress</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.

No comments

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

Leave a Reply

LEGO - Clone Wars
BlueHost
HBO
PCSecurityShield
iTunes
iTunes Sarah Marshal
Nimrod Nation
iTunes
LEGO - Castle
Fujitsu
iTunes
LEGO
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