I have been working on a re-write of the Sandbox LEGO WordPress theme. It is taking a lot longer than I thought it would, mostly because I have made the problem more complicated than I initially thought it would be.
One of the main things I wanted to offer in this theme was the ability to choose a color scheme from an pre-set offering of about 8-10 choices. This wasn’t too hard, I had done some similar in the original Sandbox Soccer theme.
As I worked on it I decided it would be nice to allow the user to define what the header should look like including their own image. WordPress offers the ability to upload and use a custom theme header but this didn’t do quite what I wanted. I decided to let the user choose a header image from the media library. But what if the user wants multiple header images? Hmmm. This problem could get very complicate very quickly. I decided to constrain the problem by providing the ability to define up to three (3) header images: Left, center, and right. Doing this would support the 3-4 sites I expect to use this theme on (my own CarolinaTrainBuiders.com site, NCLUG, NCLTC, and ILTCO).
Now that I knew what I wanted, how to implement it. Simply showing the image options on a Theme Options page could potentially result in an enormous page. I mentioned jQuery Accordion in a prior post, dividing the various options into sections using the Accordion made sense and was pretty straightforward once I upgrade to WordPress 2.8.4.
Once the Accordion was working I decided I wanted an elegant way to select the images. Since this effort is a hobby and I largely do projects likes this to learn something, I decided I wanted to use a drag and drop mechanism to select the images. Again, jQuery to the rescue, namely the jQuery draggable and jQuery droppable plugins. In particular, the Simple Photo Manager demo was very close to what I had envisioned.
It has taken me a little while, mostly because I haven’t had a lot of time to work on it but I finally have a pretty slick theme options page working where the header images can be selected from the media library using drag and drop. I am by no means a jQuery guru but I have learned a fair amount working this problem out. The code I have isn’t ideal and I’ll continue to refine it but it is working so I can continue to develop the theme. Once I get it running and released I will go back and clean up the jQuery code. For now, getting it working and doing what I wanted was the primary task.