Now we have to talk about what we’re going to do with the two hooks. I’m sure you are already familiar with the fact that Thesis has the ability to save design options. If we come down to Thesis and Manage Options, it has this built in ability for you to download options, to go back to the default options and for you to upload options.
Use Thesis to Create the Default Options
If you’ve watched any of my Upgrading Thesis tutorials, one of the things I suggest is that you back up because it’s so easy to restore is a copy of your theme options before you upgrade. We’re going to use this same system for getting our theme options because we’ve done a whole bunch of work here creating this theme. We’ve set a whole bunch of design options so now that we’ve set it, we’re going to use Thesis to create our default set of options.
We’re going to go to design options and say, Download Design Options. Now that I have this Thesis Design Options sitting on my hard drive, I can actually totally screw my site up by saying, Restore Default Design Options. If we come over and look at our site, now everything is just beat up.
I might even beat it up more by coming over to my design options and hit save and restore. Now, it’s really screwed up. But the good news is that we can get back to those options by simply going back over to Manage Options and upload our design options. Come back over to design options, hit save, refresh the site and we should be back to where we were.
We’ve got this nice system in place for making that work or making parts of that work. While we’re at it, what we’re going to do is look at that file so you can see what it looks like. We’re going to open it up in Notepad so it’s just a plain text file. I want to look at all files then you can see that this set of design options is essentially, unreadable. It’s not like you can tell what’s really going on here.
Adding Serialized Array to the Site
Now, if you knew how to read a serialized array, you would actually be able to read this but obviously, you don’t know how to do that, I certainly don’t know how to read a serialized array. What this is doing is this is just a plain text file that saved all of our current Thesis Design Options as a serialized array. What we’re going to do with that is add it to our site.
We go back to downloads, go down to Thesis again and to Thesis Design Options. What I’m going to do now is change the name of this to thesis-responsive-options. Obviously, there’s nothing magic about the name of this. This is named whatever you want to name it but I’m naming it thesis-responsive-options and I’m going to add it to the root of my child theme.
Now, I’ve got a file in here called, thesis-responsive-options.dat and we’re going to be writing a function here that is going to look in the root of the child theme for this file. On theme activation, it’s going to upload this file and set the design options based on this file which is exactly the same thing that Thesis options does.