Let’s get started.
What is PHP?
PHP is a server-side programming language and despite what you may think PHP isn’t exclusive to WordPress. Rather WordPress is written in PHP but so are thousands of other applications.
You may already be familiar with the popular “Hello World” example like this:
<html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body> </html>
It doesn’t look like much but running that on your server will output “Hello World” on a page. Ok not the most exciting but bear with me.
Where you see <?php this is the opening tag and tells the server “hey, we need to start processing some code at this point”. And then ?> tells the server “hey, for now, our code is finished”.
Explaining PHP in depth would require a book as there’s so much to learn but don’t let that scare you! Learning to program is great fun and opens up a world of possibilities whether that’s by tweaking your own website or forging a new career path.
Later on in this guide, we have a whole section dedicated to learning resources that you can jump to but we think you’ll be more interested in continuing to know about PHP in WordPress.
WordPress PHP — What is it? And What Does it look like?
WordPress is coded in PHP and has its own API (application programming interface) terms. You’ll regularly come across the terms hooks, actions, filters, the loop, templates, themes, and plugins when reading about development in WordPress.
But just what are all these terms and what do they mean?
Filters and actions (hooks)
In WordPress, there’s something called hooks. Hooks are filters and actions that allow you to either extend functionality (actions) or filter data to perform changes on the output (filters).
To understand more about what actions and filters are and what they do, we’re going to take a look at one of the most popular plugins for WordPress, WooCommerce.
What are WordPress actions?
Actions in WordPress are a way to add new parts to your website, plugin or theme. For example, in WooCommerce actions can be used to:
- Add a new checkout field.
- Add new shipping methods.
- Create a new payment gateway.
And so much more.
Let’s take a look
This article was written by AJ Morris and originally published on WordPress News and Updates from iThemes – iThemes.