In this session we discuss how to create constants to reference skin, box and package files in Thesis 2. Thesis 2 constants can be found in thesis.php. We use WordPress and Thesis constants to create our own custom constants.
Member: How about now?
Rick: That’s better. Yes, thank you.
Member: Okay, sorry about that.
Rick: No problem.
Member: The question is regarding Thesis 2 and because Thesis now generates its own folder where we keep our boxes and skins, etc. which is in the… it’s actually the same level as themes in the WordPress file structure. Now how would I get the directory path on say, a box or a skin? Because if I was to do something like blog info template path then it will go to the themes folder, wouldn’t it? Which is actually a level above where I need to be.
Rick: Yeah, you wouldn’t want to use the… right. You wouldn’t want to use the template. What you would use instead is… let’s see. I should open up one of my own. Well, you can start off by using a Thesis constant. So Thesis… the Thesis constants can be found in Thesis php. And so Thesis constant you know, starts off using template path as the beginning part.
Rick: So there is a Thesis user, a Thesis user skins, a Thesis user boxes and a Thesis user packages. Now you don’t have to use these constants. You could create your own constant. And if you’re going to create your own constant, you would start off with a wp content directory constant so it’s wp_content_dir. So as a practical matter, I do this in all of my boxes or virtually all of my boxes.
So for example, in public function construct, I say define my unique preface path and you’re going to define both. You’re going to define a local path and you’re going to define the URL. So I define my local path by Thesis user boxes and then slash the name of the box or the name of the box folder. And then the URL is the same except I used Thesis user box’s URL and then the name of that. Now I could just as easily you know, say wp content dir and then here, thesis boxes. That’s the same thing.
So now that was kind of a long-winded answer. Did that get to your question?
Member: That nailed it. Thank you.