Looking at PHP for developing WordPress themes

1. Intro to PHP

This week I started studying PHP in detail. Although I’ve played around with creating some custom WordPress themes, and therefore have had a little experience with the PHP involved in constructing them, the resources from this week provided a valuable foundation for understanding what is really going on.

The two main resources I looked at were:

I found both of these resources really helpful in different ways — and especially useful in conjunction with each other. I began with the Lynda.com videos, which provided a thorough but understandable introduction to PHP, including several exercise files that I was able to follow along with in order to replicate the examples the instructor of the course covered throughout the videos.

I started the Codecademy tutorial when I was a little more than halfway done with the Lynda.com videos. This turned out to be (1) a great refresher of the concepts talked about in the videos, and (2) a useful look at PHP from another perspective, which translated well when I returned to the Lynda.com videos, as I was able to notice things that the instructor was doing that I may not have otherwise immediately understood.

Major concepts covered included:

  • An overview of what PHP is — A server-side language rather than something client-side such as JavaScript; PHP isn’t going to show up in the code of a webpage when you use “view source,” since it exists solely on the server end, not in the browser… This was a concept we touched on briefly in a course I took last fall (490TEH Intro to Tech in LIS), and I was happy to find that it now made more sense to me/reaffirmed what I had understood from the 490TEH discussion.
  • Basic PHP syntax
  • Looking at different ways PHP can be incorporated into HTML files
  • if/ifelse statements, while loops, arrays, and multivalue arrays — Although the syntax is different, I found that a lot of these concepts were more easily understandable to me because of my study of Java in 452AG Foundations in Info Processing. Some of what was covered I had already vaguely intuited from my minimal time spent playing around with WordPress theme files. It was great to have clear explanations specifically in relation to PHP that were given in both the videos and the Codecademy tutorial.

2. Setting up a WordPress Development Environment

I set up XAMPP, the PHP Development Environment for Windows that was suggested by the instructor of the Lynda.com PHP course I was viewing. This allowed me to follow along with the exercises and examples in the course. It also provided the option to install WordPress as an application, so I now have a local development environment for when I’m ready to start designing and testing my WordPress themes.

3. Looking towards the WordPress-specific basics

I also looked at several chapters from the WordPress Theme Development Beginner’s Guide. This covered basics that now are making much more sense to me, especially after going through the process of installing WordPress locally for testing and development on my PC.

The Beginner’s Guide reviewed the basics of a WordPress theme — the core installation, theme files, plugin files, and the MySQL database — and how these all interact, through PHP code, with what is finally displayed on the browser with HTML and CSS. Although I have heard all of this before, it’s really helpful to me to have set it all up on my own machine, where I can see each step taking place and better understand the client/server communication.

I also reviewed the Template Hierarchy, both in the Beginner’s Guide reading and in WordPress’s own documentation. What I’m taking away from the Template Hierarchy right now is that:

  • It allows you to include the header, sidebar, footer, etc. within multiple pages, without having to hard-code these areas into one single index.php file.
  • It works through “The Loop,” which the Beginner’s Guide says “isn’t pure PHP… most of [the code is] WordPress-specific tags and functions such as template tags, which only work within a WordPress system.” That being said, I feel much more confident in understand how PHP employs loops in order to create pages that draw from a database, so I think I at least have a working foundation in understanding how the WordPress-specific Loop functions.

I skimmed through several other chapters of the Beginner’s Guide, and I think there are some that I will probably return to in later weeks, as I begin to work more in-depth with WordPress and with creating my own custom themes. One of the final take-aways I got from this resource was the suggestion to work with a CSS framework when designing a theme, which is an area that I have scheduled to look into further in one of the Lynda.com video courses I’ll be watching during this upcoming week.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.