Well, good morning everybody and welcome to Lesson 9 of the Customize Thesis Like A Pro tutorial course. In this lesson, we are going to have an introduction to customizing the Thesis theme using PHP. In Lessons 1 through 8, we focused entirely on editing Thesis using custom CSS and now we are taking the next step to talking about using PHP.
Our PHP Lesson is for Beginners
I received a couple of questions in the registration process that I think are best answered here at the very beginning. Gary says that he’s new to WordPress and to PHP and is this where he should start and would he be better off with some pre-requisite course or training? This is intended to be the very beginning of instruction on how to use PHP with Thesis.
There are 6 lessons currently in my course on customizing the Thesis theme. I haven’t done Lessons 7 and 8 but there are 6 lessons that preface this that address CSS. And in particular, Lessons 1, 2 and 3 address issues that I’m not going to teach today but I’ll be using concepts from. So it does make sense for you to review Lesson 1: Managing the File Structure, Lesson 2: Introduction to Customizing Thesis Using CSS and then Lesson 3: Tools of the Trade.
Lessons 1 and 2 are freely available to the public just like this Lesson 9 is and will continue to be. If you’ve had no introduction to customizing Thesis at all, it makes sense for you to review these before you try doing what we’re doing here in this lesson. But otherwise, the class does not assume that you know anything about PHP and I will be discussing everything at its most introductory level.
What PHP is and Who Should Learn It
And then the second question was from Carrie. She said she was curious if learning PHP is too much to tackle. Well, that’s kind of a hard question to answer. PHP is a programming language and the people who are going to do best with learning a programming language are those people who are interested in it. If you’re not interested in it then yes, I think it’s pretty clear that it’s too much to tackle.
2 Approaches to Learning PHP
There are 2 approaches to learning PHP and if you’ve tried to learn this at all on your own, you will have seen this traditional approach over and over again. You can essentially see that here at lynda.com.
The Traditional Approach
The traditional approach includes setting up a local server. So you set up Apache, MySQL, and PHP on your own local computer in some sort of a Wamp, Zamp, Lamp kind of format. And once you have that server set up then you start off with the first classic program of Hello World.
You essentially create a web page. The very first thing you do is use PHP to serve up Hello World. Then you start talking about the technical underpinnings of the language to learn all of the basic building blocks of the language. By the time you’re done with several hours of that, you really can’t do anything of any substance. It’s all important things you have to learn but you have to learn all of the little basic building blocks before you can actually do anything.
My Thesis Theme and WordPress Centric Approach
The contrasting method, which is the method that I teach, is a Thesis theme and a WordPress-centric approach that builds on existing WordPress and Thesis functions and starts by using those.
The traditional method has essentially 2 sets of tools. You have PHP code and you have MySQL code. MySQL is the database that generally is used in PHP applications although it can be used for other databases as well. But MySQL and PHP are generally known to work together. And so you end up learning a set of code for PHP and a set of code for MySQL.
Whereas in the Thesis method, what you’ll do is you’ll work on a live server and you’re going to start off with a very sophisticated set of tools and those tools are already generated for you by WordPress and by Thesis. And rather than the 2 tools that you had to work with under the traditional method, you have 3 tools here.
WordPress and Thesis Theme Tools
Obviously, you have the PHP code but then you’ll have the WordPress functions which is a whole tool set that you can use and you have Thesis functions which is another tool set of tools that you can use. And these will allow you to do very significant things with a small amount of learning.
Because this is a different method of learning, we don’t actually start off at the same place as in the traditional approach. We’re not going to organize learning PHP in the same way that lynda.com does because we aren’t learning vanilla PHP. We are learning PHP in the context of WordPress and Thesis.
And for that matter, while a class like this might be useful to somebody who uses the Genesis theme, it’s not immediately useful because the Thesis theme functions are a different tool set than say, the Genesis theme framework functions. And so while they both share WordPress functions, they have a higher level of functionality in Thesis that is different than the analogous high level of functionality in Genesis. So this is really the Thesis method for learning PHP.
Resources for Learning to Use PHP with Thesis
Now there are a set of resources that are available to you for learning this Thesis approach and you have to become conversant and used to the process of using these 4 tools together because there is so much that you can potentially learn.
Really, the best way to learn this is by being very comfortable using the following sites to look up technical information.
Now, this goes from most specific to least specific. The Thesis User Guide is going to tell you everything you need to know about Thesis functions. WordPress Codex is going to be quite a bit broader and deal with a much larger set of tools. PHP.net is going to be much more lower level. It has even more tools but each individual tool can do less. And then W3 Schools has a summary of some of these things.
In any case, you need to become comfortable using these resources and searching these resources. And because of that, I’m going to be relying on these resources throughout the class so I’ll demonstrate sort of a methodology of using the resources.
Work Flow – Working Locally
I’m also teaching a work flow and that work flow is described in Lessons 1 and 2 of Customize Thesis Like A Pro but I would like to reiterate it here. That work flow starts by working locally which means that you have a local file structure that is a file structure on your local computer that mirrors the WordPress Thesis file structure on your server.
The process then is to open up a local file, edit that local file, save it, upload it to your web server using FileZilla, test the function of that and then just repeat. So we’re never working on the live site. We are always working on a local copy or a local file and uploading it to a live site.
Some of you may be familiar with tutorials that suggest that you should use the Custom File Editor but I believe that is fundamentally some of the worst advice that anybody ever gives. And really, I think the only reason they give it is because they want to make it sound easier than it really is.
PHP, in particular, is very sensitive to syntax errors and WordPress will fail on certain kinds of PHP syntax errors. You may have already tried doing some customizing of Thesis using some cutting and pasting of PHP inside of your Custom File Editor and you may have already experienced the white screen of death that happens when you’ve got a syntax error.
It can be very difficult to recover from that, especially for somebody who uses the Custom File Editor. You should become conversant with a system where you work locally and upload what you’ve done locally rather than working on your live site. And that’s the process that I’m going to be teaching here.
3 Principal Supporting Tools
Finally, we have a set of “Tools of the Trade” that I teach. There are analogous tools out there that can do similar kinds of things. The 3 principal tools are NetBeans which is a free error-checking code editor and integrated development environment. So NetBeans is what I’m going to write the code in today.
Filezilla is also a free FTP client which is very easy to use and in particular, easy to configure so that it synchronizes your local file with your remote site. And then Firefox which has Firebug and Web Developer as a couple of tools.
If you’ve watched my earlier lessons, you’ll have seen me using this tool set together repeatedly. And I think this is the necessary toolkit for somebody who is learning how to customize Thesis using PHP.
There are other tools available out there and there are rambo programmers as I call them. I encountered one just a couple of days ago who had 20 years of experience as a programmer but couldn’t identify a syntax error in CSS. And he scoffed at my suggestion that he use an error checking code editor but he couldn’t figure out why his code didn’t work.
My point is that it is possible to just use Textmate or Notepad or some other kind of text editor but I think that’s the hardest way possible for a beginner to learn how to do this. So I strongly encourage you to consider these tools when you’re doing this work.