WordPress Concepts and Parts for Beginners

(I’m helping a person on simbi.com learn about WordPress plugin development. Sometimes, an article will be produced to elaborate on a topic. This article explains WordPress concepts and components.)

WordPress isn’t just blogging or CMS software, it’s a framework for general website development. Like every framework, it comes with a huge library of objects that you’re supposed to use to create your applications. This article will describe many of these objects.

WP Versus Others

WordPress’ objects are relatively large and “high-level” compared to the ones you get with frameworks like Symfony.

Conversely, they objects are not as high-level as what you get with a REST-API service. For example, if you want to work with phone calls, you can use a service like Twilio. If you want to work with files, you can use a service like Amazon S3. These services are like libraries, except they also provide storage, indexing, network connectivity, etc.

WordPress Concepts and Parts

Here’s what WordPress is made of: terms are in boldface.

Posts: WordPress’ objects all center around retrieving posts. Posts can have different types, and the default installation comes with the Page post type.

Taxonomies: A taxonomy is a list or hierarchy of terms that describe posts. WordPress comes with one predefined taxonomy type called Categories. You can define new taxonomies.

Tags: A tag is a user-supplied keyword that describes a post. The main difference between tags and taxonomies is that tags are just words, and there’s no implied structure or relationship between words.

Media: WordPress calls uploads “media”, but they are really uploads. (Media is plural for medium, and medium is a communication outlet, not the object that’s transmitted through the medium. I know this is pedantic.) Uploads are stored in the folder wp-content/uploads/. Each upload has a record in the database, and it can be an attachment to a post.

The Admin: WordPress gives you two applications: the website that the world sees, and the admin, which is where site administrators, authors, and editors can work on the posts. The admin is also called the Dashboard. The public face is called the front end, and the admin is also called the back end.

The Customizer: the admin has been getting more complicated. At the same time, the number of people operating websites has expanded, and the users’ average skill level has been declining. People aren’t getting more ignorant — there are just more people with websites, and most come with fewer skills. WordPress has an easier-to-use interface to edit some aspects of the site, and it’s the Customizer. The Customizer is becoming the primary way new users alter their site’s settings. It’s accessible from the front-end when the user’s logged in. It’s also in the Appearance->Customize menu in the Dashboard.

Extensions to WordPress

Themes: Themes allow you to change the appearance of the website. Admins can pick a theme from the theme library, install it, and then activate it. It’s like an “app” that changes the appearance of the website. Some themes come with additional software to add features to the admin.

Plugins: Plugins add features to the WordPress platform. They are like themes in that admins can install, activate, and deactivate plugins. They are different in that they don’t typically alter the appearance of the website.

Shortcodes: Shortcodes are shortcuts that help authors insert complex HTML code with a single, simple bit of text. For example, there are plugins that provide shortcodes to insert photo galleries and videos into posts. Shortcodes are defined in plugins and themes.

WordPress Concepts for Programmers

Hooks: WordPress plugins and themes integrate their features into the WordPress application via hooks called actions and filters.

Actions are events that happen during the page load. You can tell WordPress to execute one of your functions during a specific event. For example, during the page load, there’s an action called “init”. You can tell WordPress you want your init() function to run when “init” happens.

Filters are like actions, except they take an input from WordPress, and produce a “filtered” output. For example, there’s a filter called ‘wp_title’ that’s fired whenever the function wp_title() is called. The input to the filter is the title, and the output is a modified title.

REST API: the WordPress application is slowly migrating toward becoming a JavaScript application that’s backed by a REST API that publishes the site. To this end, there’s a REST API framework included with WordPress.

Admin Ajax: Before we had the REST API, Javascript browser-to-server interactions all went through a script at wp-admin/admin-ajax.php. Some plugin programmers still use this, because it’s pretty easy to use.

WP-CLI: WP CLI was a project to create a command line development tool for WP. I think it’s rolled into the system now. I may be wrong. Anyway, it’s useful to learn if you’re programming, because it provides some tools to create empty plugin templates.

That’s all for now.

Leave a Reply