I finally found a few minutes to put the finishing touches on an open-source theme conversion I’ve been working on for a while. I have posted the theme for download here. Take a look, and let me know what you think.
Category: Design
Dynamic Page Graphics in WordPress
Recently, while developing a WordPress theme for a client, I devised a handy trick to use different headline graphics for pages (it should work for posts too) based on the page title. The basis of the trick is to name your headline graphics the same as the pages they are to show up on (ex. about.png for the About page). Once you do this, you simply need to insert the following bits of code into your theme’s page template:
Part 1: Add this to the beginning of your template (just after the line that starts with “<?php get_header(); ?>”):
NOTE: Modified this to actually, you know, WORK! 🙂
If you tried it before, and it didn’t do what you expected, change the code at the top of your template to this new version.
<?php
global $post;
$title = $post->post_name;
$title = strtolower($title);
$titlepic = $title.".png";
?>
For those who don’t read PHP, what this block does is gets the title of the current page, stores it in a variable, converts it to lowercase, and then adds “.png” (changes this if you use gifs or jpgs) to the page title to create the image’s file name.
Part 2: Add this where you want the graphic to appear:
<img src="<?php bloginfo('template_directory'); ?>/images/<?php echo $titlepic ?>" alt="<?php $title ?>" />
This is a standard XHTML image tag. Change the directory to suit your needs, but leave the “<?php echo $titlepic ?>” bit as this is what does the magic. The alt parameter could likewise be changed, but it does need to be there for the XHTML to validate.
So there you have it. A painless method to get dynamic graphics for your blog, based on your page titles.
Reciprocity WordPress Theme
After switching my hosting and theme earlier this month, I decided to update and release my original blog theme to the general public. Head on over to the Reciprocity WordPress Theme page to take a peek and download the theme.
Design Vitality WordPress Theme Competition
So I decided to enter Design Vitality’s WP theme competition. Even if I don’t win any of the prizes (and they’re some doozies…first prize is $1,000 and second is your choice of an iPhone or a Wii), it still gets my name a little farther out into the world.
The winners are chosen by votes at the contest website, which is linked below, so give me some vote love if you like my entry. My theme is called “Blue Shift”. Voting opens on or around November 30, but he’s got a lot of good info on his site for designers.
Go here to vote: WordPress Theme Design Competition
Site Updates
So you may have noticed that there are a few changes on the site. I have finally gotten around to (and had the time to spare in between freelance gigs) implementing a few changes that I have had on my list for a while.
My favorite change is the addition of Live Search for the site. If you look in the sidebar, you’ll notice that the search box now says “type and wait for results”. Well, that’s all you have to do to search my site now. when you enter a search term, it will overlay (or push down the other content if you’re using Internet Explorer) a box with the search results in it. You can either use the arrow keys and enter to choose one of the results or use the mouse. You can also go to the regular search results page if you so desire.
The next biggest change is I have added AJAX commenting to posts. Now when you enter a comment, it adds it to the page automatically, without refreshing the page. It will also show icons for your country, your operating system, and your browser. You will also notice that on the individual post pages, there is now a block with the info about the post you’re currently reading and navigation links for the next and previous articles in the sidebar.
So yeah. I got a few things crossed off the list. There will be a few more changes coming, but I don’t know right now when they’ll be. Stay tuned.
Technorati Tags:
Design, Updates, AJAX, Live Search
Flash for websites?
Back in the bad old days of the web (Bubble 1.0 for those of you who remember it), Flash was everywhere. You couldn’t develop a website if it didn’t use Flash. Was it a good thing? Probably. It broke the web out of it’s static, photos and text only infancy. I honestly believe the web wouldn’t be the medium it is now if it wasn’t for those early Flash days.
However, Flash also came at a cost. Overhead, unsupported platforms, you name it. There was also the fact that back in those days, broadband wasn’t anywhere near as prevalent as it is now. So we had websites with two version, one with Flash, and one without. Not that this was a bad thing…it made sites available to everyone, broandband and dialup alike.
Then, it all stopped, for the most part anyway. There are still places that use Flash for their web interfaces, but for the most part, people figured out that all the baggage that Flash brought with it did nothing for the usability of the site. Yes, it’s pretty to look at, but seriously, which would you rather have? A site that works the way you want it to, or a site that is pretty but limited? A site that makes it easy to add content, or a site that you have to hard-code your content into? Don’t get me wrong, I’m not anti-Flash, I just don’t see it as being viable for web interfaces. Cartoons, sure. Videos? Ok. Games, absolutely. Websites? Not so much. Embrace Web 2.0 (or whatever it’s called these days), learn CSS and AJAX, and code sites that are pretty and usable.
Don’t agree? Let me know your thoughts…leave me a comment.
Live Writer
I haven’t mentioned it yet, but I have been using Windows Live Writer for a while now to do my blog posts, and I must say, I am VERY impressed. Even better, I now have an extension for Firefox (Live Writerfox) that lets me post directly from my web browser using Live Writer. It’s a pretty nifty setup…there was no configuration to be done, it just works.
There are also plugins for Live Writer that will let you use pictures from your Flickr photostream, insert Technorati tags. and other such functions. Live Writer also supports most (if not all) of the major blog engines, including WordPress, Movable Type, Blogger, and LiveJournal. Give it a try…it may be a beta product, but I have yet to find any serious bugs.