truly dynamic headers
Friday, 6 November 2009
So I have been on a hunt a while now, for a tutorial on how to create dynamic header images. I have a site which I have dynamic headers images…well kind of. I have a long, if/else statement, where I have written elseifs for each category and page. While this works, it entails updating the code each time I add a new category.
I would like to have some fancy php that could simply look into a specified folder for an image named after the category, and if it couldn’t find an image with that name to use a default. I’ve tried looking on the internet, but since I’m not really sure how to do, I don’t know what to search for. I know this entails three major things: 1)defining the category as a variable (doing something with in_category() or is_page() to create the variable). 2) using that variable to then search for a .jpg by that name, with a fall default if that search fails. 3) Lastly, it should then be pretty easy to display the image that I just asked for.
I write this post hoping, someone reading this may aid my search with some suggestions, or links.