PHP stands for Hypertext Preprocessor (no, the acronym doesn’t follow the name).
It’s an open-source, server-side, scripting and programming language primary used for the development of dynamic interactive web applications. The bulk of WordPress is written using the PHP scripting language, which makes PHP an essential programming language for the WordPress community.
By a scripting language, we mean a program that is script-based (ie, does it processing on the server where your website is hosted).
In this article, we will explain more about the meaning of the server-side and how PHP functions. Then we will proceed to the specifics of how PHP applies to WordPress.
HOW DOES PHP WORK?
As mentioned earlier, PHP is a server-side scripting language. Server-Side means that all of the processing takes place on your web server before getting delivered on your visitor’s browser. Websites use two types of languages; the client-side language and the server-side language.
DIFFERENT VERSIONS OF PHP
According to W3Techs, PHP is used by over 83% of all websites that use server-side programming language, with ASP.NET coming in second place with a little over 13% market share.
Like other programming languages, PHP has different versions with PHP 5 being the earliest version still in use today and almost nearing its end of life. Versions like PHP 5.6, the most recent of the PHP 5 version series, no longer receive active support. 2019 is the set date for the end of premium security support.
PHP7 is the newest version of the PHP series. it is the current version of PHP and offers significant security and performance improvements on the previous versions. TrulyWP currently supports:
- PHP 5.6
- PHP 7
- PHP 7.1
- PHP 7.2
- PHP 7.3
TrulyWP makes it easier to change your current PHP version. You can do this by selecting the website from your list of installed sites on the site option. On the left options pane, select advanced from the options. From here you will be able to view your current PHP version and select a PHP version you will want to switch to from the drop-down menu.
It is highly recommended to use version 7 for your PHP settings. Lower versions like PHP 5.6 can be used only in situations of backward compatibility with some third party plugins still trying to catch up with the latest PHP code support.
HOW TO USE PHP IN WORDPRESS
If you download the latest copy of WordPress and open the ZIP file, you will notice that most of the contained files are of type PHP. This is because PHP is an essential part of WordPress.
Similarly, themes on WordPress do have a similar identity with PHP files an essential part of its content. See image below for the default twenty seventeen themes:
Plugins likewise have PHP as the core
Beyond having PHP as its core files, WordPress also includes and extends a large number of PHP classes, functions, and methods. This expands WordPress functionality in several ways making WordPress more dynamic and scalable.
HOW PHP WORKS IN A WORDPRESS THEME
Here is an example of how PHP works on the server-side of your WordPress site. Using the Twenty seventeen theme mentioned earlier as an example, you will observe that there are separate PHP fils for things like “sidebar.php,” “comments.php,” “header.php” etc. those terms should be familiar if you are conversant with WordPress. As their name implies, each of those files connects to the similarly-named area on the front end of your website.
Sidebar.php – dictates the appearance and functionality of your sidebar
Header.php – dictates the appearance and functionality of your header
Comments.php– dictates the appearance and functionality of comments on your site
Search.php -dictates the appearance and functionality of search operations on your site
Footer.php -dictates the appearance and functionality of your site footer, etc.
Whenever someone visits your site, on the server end, the webserver combines all the separate PHP files as specified by the theme, and delivers a finalized HTML output to your visitor’s browser.
MUST I KNOW PHP TO USE WORDPRESS?
No! not even close. You do not need to know PHP to be able to manipulate basic WordPress. The beautiful thing about WordPress is that all of the core PHP codes have already been written for you inform of the WordPress software, WordPress plugins, and the WordPress themes.
Learning PHP could be helpful but not necessary to operate WordPress. Advanced WordPress users who know their way around PHP can be able to perform more complicated tweaks to their primary WordPress site. This knowledge of PHP is helpful if you wish to develop your own WordPress plugins and themes.