Thesis 2.0 now includes the ability for developers to create bolt on “applications” for adding to and customizing your website. These add on customization files take the form of Skins, Boxes and Packages. In this part of the seminar we do an overview of the files and file structure of those new elements.
There are other customization files and those are add on customization files. We have essentially 3 add on customization files.
Add On Customization File: skin.php
We have an add on customization file for skins and in each skin, that is called the skin.php. Skin php can’t be named anything else. It’s inside of the skin in the root of the skin and it is a file that when you update or upgrade the skin, it’s one of those files that can change. So it’s only meant to be used by skin authors. It’s not meant to be used by skin users.
If skin users want to add some custom functionality to their skin, they should use the custom.php folder or file. Skin authors shouldn’t use the custom php file. The skin author should use skin.php instead. Also you should use skin.php if you’re going to include other directories and other files which I’m sure sophisticated skins are going to do. You would include those here.
If any of you were in my child theme class for Thesis, we had this functions php where we defined our own constants and then we included our own sets of files which followed a file structure that had a library and then had its own sets of folders. And inside those folders, it had its own sets of files. We used functions php as the basis for setting up that file structure and including all of our files and all that kind of stuff.
And that’s essentially what skin php would be for you in a skin and again, this is not a user editable file. It is a core file for the skin. But nevertheless, that is what it is. When you create the skin, you have to create it using skin php and you can trust that your user’s not going to edit skin.php because they have their own ability to edit custom.php inside the skin.
Add On Customization File: box.php
The next add on customization file, as you might well imagine, is box.php. So anytime you create a box, that box starts off with box.php. This is what Thesis is looking for. Thesis goes through the boxes directory, finds every instance of a box and looks for the box php. It grabs this header information so that it knows this stuff and then processes the box.
This is my Orbit slider helper box and I don’t have the need for multiple files here. There’s only a single file. But if you needed multiple files for organizing your box, box.php would be the primary file and then all the rest of the stuff you would include from here, other files.
Add On Customization File: package.php
And while we don’t have an example of this, the same thing is true with package. So if you have a new folder, my package… let’s see, test package. Okay, test package is going to have a new php file in it called package. And package.php is going to be the main file for the package in the same way that a box.php is the main for a box and skin.php is the main for the skin.
Customization Files Intended for the Developer
So those are the 3 add on customization files that you have and they are designed specifically for the developer. They’re not designed for the end user.
Customization File Intended for the End User
The one thing that the end user gets in skins that it doesn’t get in boxes or packages is that in skins, the end user gets a custom.php and that custom.php allows the end user to add some more functionality without actually hacking the core of the skin.
Interacting with WordPress in Customization Files
We have a question about adding wp only php snippets. Yes actually, we’re still using WordPress. So to the extent that you need to interact with WordPress, you can interact with it from these customization files.
I can show you two examples of this. The first one is in this skin that I’m working on in skin php. I’ve added an action to wp head which adds this meta tag, right? So add action wp head is just a typical WordPress hook and a typical WordPress function and it happens just fine. The wp head can be called easily from this and in fact to the extent that you do so, you can access in it or admin in it or template redirect or any of the other standard WordPress hooks and filters from inside your skin php.
The same thing is true with box.php, if I recall correctly. Because inside of box.php, I used the image size name’s choose filter that exists inside of WordPress and I used add image size that exists inside of WordPress and I used add theme support that exists inside of WordPress.
So this is very much a regular extension of WordPress functions and you have access to all those ordinary WordPress functions. I know I have a custom taxonomy that exists because of this Orbit slider and that custom taxonomy is slider categories. And so I can get the terms of that slider categories and then I can list all those terms out and the whole using shortcode exists and you can create shortcodes if you want.
So there’s a lot of ability to ordinarily interact with WordPress and WordPress functions from inside of a box or a skin or apparently, a package. And if you’re editing somebody else’s skin, the ordinary thing to do would be to put that in custom.php inside the skin. If you’re creating your own skin, you’d put it in skin.php. So that’s the way that would work.
Files Automatically Added by Thesis
There’s one other thing I wanted to point out and that is when you look at these files here, seed.php is automatically created by Thesis when you hit save template. And actually is augmented when you hit save and compile in the CSS because that stuff all gets stored here in this file. So you could, of course, create your own stuff here to the extent that you wish but really, the point of this is that it’s automatically generated by the Thesis skin editor. And the same thing is true with css.css. CSS.css is the only CSS file that is automatically added to Thesis.
So if you want to use your own version of custom.css, you’re going to have to include that file inside of either your skin or your custom folder because Thesis is not looking for it. So to the extent that you still want to continue to use a custom CSS file, you’re going to have to create it yourself and you’re going to have to on queue it yourself.
And certainly you know, on queueing it is simple enough. It doesn’t really require a lot of extra effort on your part. You just use on queue styles and then give the path to your custom CSS file. But there is no automatic reference to it. So any other CSS file that you may want to add, you’re going to have to on queue yourself and you’ll be on queueing it, generally speaking, if you’re the skin author from skin php and if you’re an end user, from custom.php. But as it sits right now, Thesis does look for custom functions.php but it does not look for custom.css.