• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Mobile Atom Code Header Logo Glow

Mobile Atom Code

Accessibility, privacy, and security compliant WordPress themes

This site uses cookies to analyze our traffic. For more information see our privacy policy. Cookie Policy
  • Home
  • Articles
  • WordPress Theme
  • Theme Docs
  • Contact

 
 

The Coding Languages of WordPress – PHP

Graphic of PHP code used in WordPress

PHP

Contents

Tutorial Image

  • What is PHP?
  • What does PHP do?
  • PHP Frameworks
  • PHP Resources
  • This is the third in a series of posts looking at the coding languages that form a WordPress site. It features a quick overview of how PHP works on you site.


    In general, when coding a site for WordPress, you should prioritize languages in this order. First, accomplish anything you can with HTML, the subject of the first article in the series. Then with CSS, the subject of the second article, then PHP, the subject of this article, then Javascript, the subject of the fourth article. Doing so will minimize the size of your webpages, speed up loading, and help your SEO and user experience.

    PHP and Javascript code is more likely to be updated by developers once a site is live compared to HTML and CSS, which end users may also edit.

    While HTML provides your site’s meaning and structure and CSS provides its aesthetics, PHP, along with Javascript, provides interactivity and functionality. They are the frontend languages used in WordPress. In other words, they control what is seen in the browser.

    What is PHP?

    Created in 1994 by Rasmus Lerdorf, PHP is now a recursive acronym for PHP: Hypertext Preprocessor. A popular open-source general-purpose scripting language, PHP usually focuses on server-side scripting.

    It is a very flexible tool that can be used for good (WordPress) 😉 or evil (Facebook) 🙁 . Other large users include Yahoo, Wikipedia, Tumblr, MailChimp, Flickr, Digg, and Baidu.

    It is commonly used with a MySQL database, which is the case with WordPress. A page/post is a combination of PHP, HTML, Javascript, and MySQL statements laid out with CSS. PHP files can contain all of these but only output HTML.

    Image courtesy of visual.ly. Select the image to see the entire infographic.

    Sections of your WordPress pages and posts are stored in php frontend template files in your theme. These include:

    • The Header
    • The Footer
    • The Sidebar
    • The Loop – “Body Pages”

    As seen in the image above, the WordPress Loop may contain index.php (homepage), archive.php, page.php, single.php, comment.php, or search.php files.

    Much of your site’s functionality is coded in the functions.php file. Although more modern programming practices break it up into multiple modular components.

    The backend of WordPress (admin area) is also built with PHP.

    PHP Logo

    PHP: Hypertext Preprocessor

    What makes PHP different from something like client-side JavaScript is that the code is executed on the server, generating HTML, which is then sent to the client, usually a browser. The browser receives the results of running PHP scripting but doesn’t see the underlying code.

    Like other scripting languages, PHP has variables, data types, operators, values, parameters, expressions, if…else…elseif statements, switch statements, loops, functions, arrays, scopes, and superglobals.

    What does PHP do?

    • PHP generates dynamic content
    • PHP creates, opens, reads, writes, deletes, and closes files
    • PHP stores form data
    • PHP adds, deletes, and modifies data in your database
    • PHP encrypts that data
    • PHP sends and receives cookies
    • PHP controls user-access
    • and much more

    The current edition of PHP is PHP8. The latest update and evolving CSS are doing more of the work Javascript has historically done.

    PHP Frameworks

    WordPress is not a PHP framework but a CMS (content management system) that uses PHP code. PHP frameworks can also be used to build things other than CMSs and websites.

    To quote Wikipedia frameworks are “an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software.

    It provides a standard way to build and deploy applications and is a universal, reusable software environment that provides particular functionality as part of a larger software platform…

    Software frameworks may include support programs, compilers, code libraries, toolsets, and application programming interfaces (APIs) that bring together all the different components to enable the development of a project or system.”

    A PHP framework provides the core infrastructure for turning an incoming HTTP request into an HTTP response.

    PHP frameworks include:

    • Laravel
    • Cake
    • FuelPHP
    • Zend
    • Symfony
    • CodeIgniter
    • Phalcon

    Wrapping Up

    As you have seen, PHP is a much more complicated language than HTML and (to a lesser degree) CSS. It is the primary coding language that makes WordPress work. Like CSS, many books and websites cover extensive details of PHP. Since this is only an introductory article, below are some useful resources for you to explore.

    PHP Resources

    • Introduction to PHP (How-Tos) – https://www.w3schools.com/php/php_intro.asp
    • Official PHP Site – https://www.php.net/
    • WordPress PHP Coding Standards – https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/
    • PHP: The Right Way – https://phptherightway.com/
    • Custom WordPress Page Templates – https://www.smashingmagazine.com/2015/06/wordpress-custom-page-templates/
    • PHP Snippets, Functions, Tutorials & Tools – https://phpbuilder.com/
    • Zend PHP Blog – https://www.zend.com/blog
    • What’s Coming in PHP8? – https://stitcher.io/blog/new-in-php-8
    • LAMP, the WordPress Software Stack – https://en.wikipedia.org/wiki/LAMP_(software_bundle)

    Reuben Walker

    Author Image

    Reuben is Ringmaster of Mobile Atom Media and its division Mobile Atom Code. In addition to his content specialties, he is also a full-stack developer.

    An ABJ graduate of the University of Georgia and MA graduate of Georgia State University, he lives in Orlando, FL, with his wife and English labrador. He received his full-stack certification from the University of Central Florida.

    For great curated and original content on entrepreneurship, content, design, and code, follow him on the social media platform of your choice via the icons in this site’s footer. Or join the 42,318+ followers of his Flipboard Magazines.

    Share this:

    • Twitter
    • Tumblr
    • LinkedIn
    • Reddit
    • Pinterest
    • Facebook
    • More
    • Print
    • Pocket
    • WhatsApp
    • Telegram

    Footer

    Mobile Atom Media grows your business via a strategy for the content in your site, blog, social media, streaming, and email communications.

    Follow

    UCF Accredidation Logo
    Mobile Atom Code Logo
    Mobile Atom Code designs and produces digital media like sites, email templates, visuals, videos, and apps for use in your content marketing.

    Follow

    Copyright © 2021 · Compliasis Pro On Genesis Framework · WordPress · Log in

    • Search
    • Privacy Policy
    • WP Codex
    • WP Developer
    • WP Gutenberg
    • WP Themes
    • WP Plugins
    • WP Accessibility
    • WP Coding Standards
    • WP Support