Mastodon

My Great WordPress Resources!!

I have put together some links that have helped us get started on WordPress development. Most of the content listed below is for beginners and doesn’t touch on how we do WordPress development. I will add an additional comment below regarding setting up VS Code to work with Docker and WordPress coding standards and how composerized WordPress project is setup.

General WordPress Information

A lot of the conference talks offered at “WordCamps” and WordPress meetups are recorded and can be found here: https://wordpress.tv/

There is a lot of great information in these talks, if you are curious about something WordPress related I highly recommend searching the site.

WordPress Template Hierarchy

Whether you are building a traditional PHP WordPress theme or the new Full Site Editing (FSE) HTML theme the following image explains how templating works in WordPress.
https://wphierarchy.com/

Here you can find a detailed explanation: https://developer.wordpress.org/themes/basics/template-hierarchy/

WordPress Hooks

WordPress hooks are a cornerstone of WordPress development. There is a hook to modify nearly every aspect of the WordPress codebase. Most plugins add them throughout their code. If you are working with a mission critical plugin and need a hook somewhere in the code, it’s usually not a big deal to ask the plugin author to include it if you make a decent case for it. Aside from the crazy things a developer might do with a hook (thereby creating additional support requests) typically adding a hook to the codebase has almost no impact on the author/plugin and can make all the difference to your development experience.

Furthermore hooks are generally maintained for the life of a project, whereas template files will change. Therefore it is preferred to make modification via hooks as opposed to overriding a template file.

  • Event Driven Programming, i.e. they fire off in a specific place of the code or when a regular action takes place.
  • You can make complex changes without modifying files inside a plugin, theme, or WordPress core.
  • Extending code using hooks is generally safe, plugins rarely remove hooks and they are typically backwards compatible.
  • Hooks can be found by searching for do_action or apply_filters
  • Actions do something and don’t generally have a return statement. i.e. echo $something;
  • Filters change something, i.e. the filter the_title will allow you to modify output of all post titles, they always have a return statement.

WordPress Plugins

WordPress is known for its massive plugin directory. It’s one of the reasons WordPress is useful for fast prototyping. But be careful, not every plugin is a gem. In fact many are not particularly coded well. If you are looking to add a plugin to your project, you should know what is in it. Review the code before adding it to your repo (or in most cases composer.json file — we will get to that below.) Now there are some exceptions to this rule; Yoast, Gravity Forms, Elementor, and plugins such as these are massive and very very popular. Unless you are undergoing security scans it’s probably not necessary to know every line of code in these plugins.

WordPress Development

There are countless great blogs out there about WordPress development. I have a small curated list. Some are possibly a little out of date, but the content is still good. Most of these are backend oriented or focus on devops more than frontend technology.

  • https://tommcfarlin.com/ Tom covers many subjects these days, but he has a number of articles about writing OOP (object oriented programming) inside of WordPress plugins.
  • https://carlalexander.ca/ Carl also has a lot of great information about OOP in WordPress — in fact he wrote a book on it.
  • https://helen.blog/ Helen is Lead Contributor to the WordPress Project and though she doesn’t blog often there are some useful gems.
  • https://torquemag.io/ This is a site by WPEngine (a WordPress hosting company) this blog ranges from business oriented to covering new developer trends.
  • https://pluginmachine.com/blog/ This blog covers some niche developer topics like using composer, creating plugins, using laravel inside of WordPress.
  • https://deliciousbrains.com/blog/ This is generally a very good blog to find db specific information, they were at the forefront of writing active background processing for WordPress — which eventually found it’s way into the core of many plugins such as WooCommerce.
  • https://joshpress.net/blog This developer does spend more time on frontend tooling than my other resources listed. They also discuss composer, namespacing, typescript in WordPress, developing on windows, nextjs, etc.
  • https://pippinsplugins.com/category/tutorials/ Though old resources, there is a fantastic tutorial about using custom database tables in WordPress. This is highly underrated. When focusing on enterprise clients if they are using WordPress to manage a very specific content type with a lot of attributes, creating a custom table might just be the way to go.

WordPress Block Editor and FSE (Full Site Editing)

I have comprised a number of articles below that were useful for me getting started with writing custom blocks and understanding how WordPress FSE worked. The block editor (aka Gutenberg) has been a part of WordPress core since 2018. This is an important piece of information when discussing how to build out new sites. Many folks have a negative view of the block editor and want to “wait and see” how it fairs before going all in. But the fact of the matter is that it’s not new. The block editor is more performant than any page builder (out of the box) and is more future facing. There are of course issues with it like any other framework, but it is constantly evolving.

Posted in

Marc

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.