Welcome to PHP 101, to the quickest, simplest PHP tutorial around, and the only PHP tutorial written specifically for the average WordPress user. I cover only the minimal amount of PHP necessary to competently modify your themes (and maybe even to modify plugins).
What this is
My tutorial is only a few pages long; you can read it in 20 minutes. It covers basic PHP syntax. It tells you how to assign a value to a variable, how to check that value, and how to set up a PHP
if ... else ... statement. From my experience, that's all most WordPress users need (and want) to know. If you want more details later, try PHP.net's tutorial .
After you have mastered the basics, you can visit one of the subpages linked below to learn several little tricks that folks ask about frequently in the wp.org support forums :
- How do I make my first post look different from the rest?
- How do I make my posts (or anything else) have alternating colors?
Most tutorials are written in inaccessible, overly technical language. I'm going to write as clearly and non-technically as possible. So please don't complain if you notice me being a little less than precise.
Table of contents
As you click through the pagination links below, we'll address the following topics:
- Introduction (this page)
- What is PHP? PHP vs HTML
- How do I insert PHP into a web page?
- Conditional statements (
- Variables in conditional statements
- Functions, and the difference between
Ready to get started? Click on "page 2" below. (Look below the ad.)