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
Posted on: Friday, October 24th, 2008Tags: 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.


.gif&contenttype=gif)








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