I'm working on building a custom theme for a client and one of the things I need to incorporate is a rotating banner. I'm having some problems, however.
I've looked at a number of other themes to try and get some ideas about ways to implement this and they seem to be divided into two groups:
1/ Grabbing the image attached to certain posts and rotating through them
2/ Getting all of the image files in a specific folder and rotating through them
Option 1 is not really suitable in this instance since the images in question are specifically banner images and have nothing directly to do with any of the content.
Ideally what I'd like is to be able to add images to the media library and tag them for use in the banner, or to a specific banner repository if such a thing is possible. This would allow the client to easily update the images himself since he's not really comfortable with the whole FTP and messing around with files directly thing (and to be honest, I'm not that comfortable about encouraging him to!). I haven't been able to find any existing themes - at least, not free ones that I can go and poke around in - that do it this way, however, so I'm not sure if it's possible.
Does anyone have any ideas about how this could be achieved?
Failing that, I'm willing to settle for Option 2. I've found a couple of themes that do it this way and have already tried having a fiddle with their code but have come up against a problem. The PHP code to open the folder to inspect its contents tends to look something like this:
$folder = 'headers/'; $handle = opendir($folder);
This is not working at all. No idea why. There's no error messages. It just doesn't return anything. I'm not really all that experienced with doing direct file and directory work with PHP so I'm not even sure where to start looking. I'm also not sure if it's relevant that the theme I'm creating is a child to another theme.
So can anyone please shed some light on one or both of my problems here? It would be greatly appreciated and will earn you virtual brownie points (which can be redeemed later for virtual brownies).