Part 1 – The File Structure
Thesis 2.0 comes with an entirely different file structure from Thesis 1.x. Now all of your customization files are stored in a separate directory structure outside of wp-content/themes. In this part of the seminar we discuss the new file structure and how to use it.
Well good morning everybody and welcome to this last Thesis 2.0 launch week seminar. Today we are going to do a code review of the new Thesis 2.0 code base.
Code Review of Thesis 2.0
If you came to this hoping to talk about non-code related items or if you came to this not really knowing what HTML or CSS is, this is probably not the best place for you because we’re going to spend the majority of our time talking about the technical side of Thesis 2.0.
We’re going to look at what I think to be the fundamental elements of the Thesis 2.0 core that developers are going to want to interact with. Then we’ll take a look at skins and how to export them and how to create them and how to reset the Thesis classic skin if you want to recover from that.
All of this is code related so if code gives you the screaming heebie jeebies then this is 2 or 3 hours of your life that you don’t want to spend here. But if you are interested in the code, that’s what we’re going to do here this morning.
Thesis 2.0 code is entirely different in the first place. It’s almost never procedural anymore. It’s almost all classes and methods. And it is very efficient which means it’s not always quite as straightforward looking as you might like it to be.
So it’s a little more difficult, at least a little bit more difficult for me to follow than the Thesis 1.8 core. I think probably, there is really no old core code in the new core. So if you were comfortable with the old core and you knew how things worked you’re going to be surprised with this core as it’s entirely different.
On the other hand, it’s designed to be interacted with more extensively. So there’s probably more things that we can do with it than we used to be able to do.
Thesis 2.0 File Structure
The first thing we’re going to take a look at is the Thesis 2.0 file structure. And this gave folks fits early on and I think it’s still is giving some people confusion because when Thesis is installed, now it creates 2 Thesis directories.
The first directory that it creates is the Thesis directory inside of wp content and themes. And this directory contains all of the core files for Thesis 2.0.
But it also creates, inside of wp content, another Thesis directory and this directory is what Thesis refers to as the user directory. And it is the directory that holds all of the customization associated with your site. And so it holds any boxes that you create or upload. It includes any packages that meet that same definition and it includes any and all of the skins that you have uploaded.
Thesis Blank Skin and Classic Skin
And it includes a copy of the Thesis blank skin and the classic skin. The Thesis blank skin and the classic skin are created out of whole cloth from essentially, this copy of these skins. So there’s a copy of the default Thesis classic and Thesis blank skin sitting here inside of the library folder in the Thesis.
And when Thesis is installed, it takes a copy of that and writes it in this skins folder over here. So that’s the relationship essentially between this Thesis skins folder and this Thesis skins folder is this is just a copy. So no actual functioning happens in here.
If you were to make changes in the Thesis classic skin here, you’d never see them reflected anywhere because Thesis does not use this for anything other than to write this when this doesn’t exist. So for the most part you’re going to do all of your work, whether you’re creating skins or packages or boxes or you’re customizing something, in here.
And there is one exception to that which we’re going to talk about here in a minute. But it’s a legacy exception. It’s not a real exception and you may choose to use the legacy exception but the chances are you’re going to be comfortable working in this context instead.
Having said that, this is our file structure. I want to talk a little bit about Thesis constants. Now the Thesis constants can be found here in Thesis php which is really the main launching point of the theme.
You know that traditionally, a theme includes at a minimum style css and sometimes, functions php. Well, this style css contains no code in it. It just has the bare minimum information necessary for WordPress to understand that it’s a theme.
And as such, style css is not cache-able by browsers and so Thesis is deliberately not putting any CSS in here. And in fact, is not even unqueueing this style css script when Thesis runs so that the CSS file is cache-able by the browser. So in any case, style css is here.
The only thing functions php does is it just requires Thesis php. So style css tells WordPress information it wants. Functions php immediately refers WordPress to Thesis php and at that point, we sort of leave the traditional WordPress file system or file structure behind.
And once we do that, we’re going to go over here into Thesis php. And Thesis php in this regard has a lot of things similar to 1.85 except that it’s got a new set of constants.