Skip to content

Getting Started

Ok, let’s start with WordPress! As you may already know, WordPress is a Content Management System (CMS) built in PHP. In this chapter, you’ll learn how the WordPress ecosystem works and how its components fit together.

When you install a WordPress project locally (using XAMPP), you’ll find different folders in the installation directory. These folders are essential to understanding how WordPress operates.

This is just a draft and a starting point. We can’t cover everything here, but the aim is to highlight the key concepts. The topics we’ll cover here are foundational, but you should definitely expand your knowledge further as you gain more experience with WordPress. There’s much more to explore beyond what we’ve touched on!

PHP stands for “Hypertext Preprocessor,” and it’s a server-side scripting language that powers WordPress. It was originally designed to create dynamic web pages, enabling websites to display different content based on user input, database queries, and other factors.

You’ll know you’re writing PHP and not plain HTML by the use of PHP tags. PHP code is always enclosed within <?php and ?> tags. Here’s an example:

<?php
// PHP code goes here
echo "Hello, WordPress!";
?>

In the example above, everything between is PHP code, and it will be processed on the server before the page is sent to the browser. Anything outside these tags is treated as regular HTML. So, PHP tags essentially “fence off” PHP code from the HTML markup, allowing for dynamic content generation.

WordPress is built on PHP and utilizes the PHP framework with certain characteristics that make it more efficient and user-friendly. The WordPress framework is based on several key principles:

  • Modularity: WordPress is built using plugins and themes, which extend its functionality.
  • MVC (Model-View-Controller): WordPress uses an architecture that separates the logic (PHP code) from the presentation (HTML output), making it easier to manage and scale.
  • Template Hierarchy: WordPress uses a system of templates that allows you to customize the display of different types of content on your site.

In essence, PHP serves as the backbone of WordPress, providing the dynamic capabilities needed to deliver content, interact with databases, and handle complex functionality, all while working hand-in-hand with HTML, CSS, and JavaScript for front-end display.

The wp-admin folder contains the files responsible for the admin dashboard. This is the control panel where administrators can manage content, settings, plugins, themes, and users. You should not edit this folder directly, as it’s crucial for the core functionality of WordPress.

The wp-content folder is where most of your custom content and modifications go. Inside this folder, you’ll find:

  • themes/: Contains all the themes used to style and display your site.
  • plugins/: Holds all the installed plugins that extend the functionality of WordPress.
  • uploads/: Stores all media files (images, videos, etc.) uploaded to the site.

wp-content is the folder you’ll likely interact with the most when customizing a WordPress site.

The wp-includes folder contains the core WordPress files that handle all the essential functions of the CMS, including user management, database interactions, and theme and plugin management. You generally should not modify these files unless you’re troubleshooting or making very advanced changes.

Another important file is wp-config.php, where key configurations, such as database connection settings, are stored. This file allows WordPress to connect to the database and set up other important parameters.

WP_DEBUG is a built-in debugging tool in WordPress, specifically designed to assist developers by enabling detailed error reporting. When WP_DEBUG is enabled, it triggers WordPress to display and log errors, warnings, and notices, helping developers troubleshoot issues with the system.

By default, WP_DEBUG is turned off in production environments to prevent error messages from being visible to end users. However, during development, it is extremely useful for identifying issues with themes, plugins, or custom code.

To enable WP_DEBUG, you would need to modify the wp-config.php file:

define('WP_DEBUG', true);

When enabled, WP_DEBUG does the following:

  • Error Display: It will display all PHP errors, warnings, and notices on the screen. This helps developers identify where issues are occurring within the code.
  • Error Logging: It logs errors to a file (wp-content/debug.log), which allows for easier debugging even when errors aren’t displayed directly on the screen. This is useful for checking logs after errors have occurred.
  • Script and Style Debugging: When WP_DEBUG is enabled, WordPress will also log issues related to script and stylesheet enqueuing, which is useful for debugging front-end assets.