Build Your Own Business Website header image

Thesis 2.0 Technical Review – Part 3 – User Editable (Non Core) Files

Difficulty Level -

Filed Under Topics -

Listed Under Lesson Subjects -

Applies to -

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

One of the most powerful aspects of Thesis 1.x was the ability to customize it while preserving those customizations during upgrade. Thesis 2.0 retains and extends that ability not only to Thesis itself but also to individual skins. The end user of a skin can safely place their own customization in a file that won’t be overwritten when the skin is updated. In this part of the seminar we look at the various files intended to be customized by the end user.

The next thing that I’d like to talk about is user editable non-core files in Thesis 2.0. Traditionally, WordPress does not have user editable non-core files. If you’ve got a theme file, the typical theme, it doesn’t have anything that the user can edit unless they’re hacking it.

User Editable Files in Thesis

When Thesis came along, it offered us a couple of user editable non-core files. It was custom functions php and custom css. Those are both files that it created that users could edit that it would not overwrite when there was an update and they were intended for the user to put their own code in.

Well Thesis 2.0 comes with that same sort of thing and the first one is just pretty much an extension of what we were just talking about, that is, custom functions php. So in its launch sequence, what it looks for is, if the file exists, Thesis custom, custom functions php then it includes that file.

So if you come over here into your custom sample and you have a file and you call it custom functions and save it. Now you have your own custom functions php file and this custom functions php file will be loaded and included by Thesis. And so at that point, anything you have in here becomes available to Thesis 2.0.

Skin Independent

And it becomes available regardless of which skin is active. That’s the thing about this. This is entirely skin-independent. It’s going to apply all the time in Thesis. You can put anything in there that you want and you can even put something might conflict with one skin or another. Hopefully, that won’t be the case but the danger of this is that this is entirely skin-independent and is agnostic of the user files.

Question: The Legacy System and The Custom Folder

Richard asks, “Can the custom sample folder be placed in other Thesis folders?” Well yeah, you can place it there but Thesis isn’t going to find it. You’ll have to use a file that Thesis will find to tell it to include the folder because the whole purpose of this folder is that Thesis knows right where it is. Thesis checks to see if it exists and if it exists, it checks to see if there’s a custom functions php file in it. And if there is then it includes that.

Once you take this custom folder out, now it’s just like any other folder. You place it just like any other folder and then you’ll have to make a reference to it. Because without a reference to it, Thesis won’t know about it.

Chris, I’m going to unmute your microphone here for just a second because it does make sense for us to work through that. Good morning, Chris. You said, “If you added the custom or custom sample folder inside the core Thesis directory, would it not be better to place those folders inside the Thesis folder with the user info?”

Well, that’s the whole point of the custom and custom sample folder is that it’s entirely outside of the skin. And that’s why I referred to it as a Legacy system. Thesis is essentially giving you the option to continue to use a Legacy system where your custom functions sit inside of a custom folder inside of the root of Thesis. That’s the way it used to be. And so they’ve allowed you to continue to use that and are redefining constants that were the same constants as they’re used to be so you don’t necessarily have to rewrite all of your code to port it over to Thesis 2.

So really, the question is, wouldn’t it be better is actually irrelevant. The reason it does this is for people who don’t really care whether or it would be better. It’s done is for people who want to be able to use exactly the same system as they used before or for customizing Thesis using custom functions php. So that’s why it’s there.

Now we’ll get to the second half of that answer later which is yes, in fact, it would be better for your customization to be themes or skin-specific rather than being skin-agnostic. And so that’s what we’re going to talk about here in just a minute. Let me just look at a couple of questions here.

Is there a danger that it will be overwritten on updates? No, it won’t be. There’s no danger that your custom sample or custom folder will be overwritten in an update. That’s not going to happen. That’s sort of its purpose that this folder is left alone when Thesis is upgraded and anything that’s contained in it will not be changed during a Thesis upgrade.

Question: Migrating An Existing Site To Thesis 2.0

Amanda asked, “Does this mean we can migrate an existing site simply by adding these folders and files?” Well, probably not entirely migrate because the HTML structure is different. Class names are different and hooks and filters are different. So no, you probably can’t migrate simply by moving over.

But as long as you can adjust class names, hook names and filter names, you can keep all of your code in that same place. It’s not necessarily likely that you’ll be able to just copy and paste from the old custom functions php file to the new because I think there are probably too many differences anyway. You can overcome them but they’re nevertheless there.

User Editable File: custom.php

Anyway, we were talking about user editable non-core files and the first user editable non-core file is this Thesis custom custom functions php file which you see referenced here. As we work our way down this launch, we see also this if file exists, this skin skins directory/custom.

Essentially, what’s that’s doing is saying okay, given the current skin and the current skins directory, is there a custom php file there? And so if we look over here in our classic skin, there is a custom php file there.

Add Skin Specific Custom Functions

That custom php file is a file where you can put skin-specific custom functions that will not be upgraded. They’re not going to be edited in an upgrade. They’re not intended for the skin author. They are intended for the end user. Custom php is intended for the end user of the skin to be able to edit the skin.

User Editable File: master.php

And then there’s one final one for the website owner and that is master php. And master php is also a skin-agnostic but it is the very last file that Thesis loads. So it can be used for things that are after absolutely everything is done.

This is primarily going to be used by multisite users or network installations of WordPress and I’m not the network guru so I don’t fully understand all the implications of that here. Kristen is more likely to be a better resource on that and I know she’s working on making sure that Thesis 2 works properly inside of multisite.

But having said that, this master is a file that you as the site owner can create and it isn’t pre-built. When you install Thesis, you don’t have a master inside of your Thesis directory. We’re talking about the Thesis user directory. It doesn’t come with a master php. You have to create that. But that’s what it looks for. It looks for a master php. And if it finds master php then it includes it.

And so those are your 3 user editable non-core files. These 3 files can be edited by the end user and they will not affected by upgrades or updates.

0 Comments… add one
0 comments… add one

Leave a Comment