Whenever someone visits your site, your web server takes all those separate PHP files for different areas in your theme, puts them together as specified by your theme, and delivers the completed HTML output to your visitor’s browser. header.php dictates how your header looks and functions.footer.php dictates how your footer area looks and functions.comments.php dictates how your comments section looks and functions.And yes, it really is that simple – each of those files connects to the similarly-named area on the front end of your site. If you already use WordPress, those terms should sound pretty familiar. You’ll see that there are separate PHP files for things like “comments.php”, “footer.php”, “header.php”, etc. PHP files in the default Twenty Twenty-One theme If you go back to that picture of the Twenty Twenty-One theme: Let’s take things a bit further with a quick example of connecting the server-side nature of PHP to your WordPress site. An Example of How PHP Works in a WordPress Theme These functions, hooks, classes, and methods are a big part of what makes WordPress flexible. Yes – that one tiny snippet can turn into a 10,000-word blog post after your web server finishes processing the PHP code. While this small snippet looks innocent enough, it’s actually what your theme uses to display the entire content of each one of your blog posts. Similarly, any theme that you install is going to include a bunch of PHP files (the screenshot below is the default Twenty Twenty-One theme):Īnd any plugins that you install are – you guessed it – also going to be primarily PHP:īeyond using PHP for its core files, WordPress also includes a huge number of functions, hooks, classes, and methods that you, or developers, can use to extend WordPress’ functionality in tons of helpful ways.įor example, one of the most well-known functions is the_content(). If you go and download the latest copy of WordPress from, you can open the ZIP file to see that most of the included core WordPress files are PHP: Here, simply use the Modify dropdown box to switch to a different PHP version. Then, go to Tools and scroll down to PHP engine: All you need to do is log into your MyKinsta dashboard and select the relevant WordPress website. You can even change PHP versions with a single click. At Kinsta, we support the following PHP versions with our custom self-healing configuration: PHP 8.0, 8.1, and 8.2 offer significant performance and security improvements. This means they will no longer receive active support and have ceased (or will soon cease) receiving security support. PHP 5, 7.0, 7.1, 7.2, 7.3, and 7.4 are older versions of PHP that have reached their end of life. Like other programming languages, there are different versions of PHP that you can use. PHP 5 vs PHP 7 and PHP 8Īccording to W3Techs, PHP is used by 77.4% of all websites that use a server-side programming language, with ASP.NET coming in second place with a little over 7% market share. They’ll just see the already-processed code that your server delivers to their browser. The end result is that, unlike HTML, your website’s visitors will never see the PHP code that powers your WordPress site. Then, once your server has processed the code, it delivers the output of all that PHP (which is the HTML code that a visitor’s browser actually receives). Before sending any files to that visitor, your server will first run the PHP code contained in the WordPress core and any themes/plugins you have installed on your site. But what does “server-side” actually mean? Server-side means that all of the processing happens on your web server before anything gets delivered to your visitor’s browser. In the brief definition above, you learned that PHP is a server-side language.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |