This is the third post in a series on learning React, for use with Gutenberg, the new WordPress block-based editor that will be powering the WordPress post editor in WordPress 5.0. React is built on top of Facebook’s React library. In this post, we’re going to take the code from the previous two tutorials and combine them. The first post just showed a very basic “Hello World” Gutenberg block. The last post backed up to a React “Hello World” example and then showed how to add components, such as those to show WordPress posts. Now in this post, we’re going […]
React Basics For WordPress Developers
In my last post for Torque, I wrote about how WordPress with the new Gutenberg editor uses React. I also gave my opinion on if WordPress developers need to learn React. While you do not need to know React to create Gutenberg blocks, I laid out a few reasons why it might make sense for you to do so. If those reasons made sense for you, good news, this is a post to get you started with React and its starting a new series of posts about using React for Gutenberg development. Before We Get Started In the first few […]
Do You Need to Know React as a WordPress Developer?
The new WordPress content editing system Gutenberg will be powering the WordPress post editor in WordPress 5.0. Gutenberg is a “block-based” editor. When creating content, everything is a block. If you have a post that is one paragraph, one header, and then two paragraphs, that’s four blocks. Gutenberg comes with a set of default “core” blocks — paragraph, header, recent posts, image, blockquote, etc. If you’re using Gutenberg to create content, you use those blocks or custom blocks that are provided by WordPress plugins you install on your site. Gutenberg is a JavaScript-driven interface. Specifically, it is built using Facebook’s […]
Why State Management, Like Redux, May Solve Your Problems
It’s only recently occurred to me that I’ve been doing WordPress, PHP, and JavaScript development for a while. In the last 5-6 years, I’ve learned some best practices that are no longer the best. For example, state management — the practice of putting all of the dynamic values of your application — a user inputs to a form, the current page’s posts, etc. — in one place, was not common. Now, I can’t imagine life without all of my state in one place. When I started writing JavaScript, if I needed to know or update the value of a form […]
How To Drop Legacy PHP Support In WordPress Plugins
In March of this year, Iain Poulson published a post on the Delicious Brains blog called “Hey WordPress Plugin Developers, Stop Supporting Legacy PHP Versions In Your Plugins.” I agreed, and am a WordPress plugin author, so I read it and wished people would listen and moved on with my day without taking any action. Later, when we announced we were dropping legacy PHP support in Caldera Forms, I cited that post as one reason for the decision. I’m being honest here, I was going to wait for someone else because I was worried that if I dropped support for […]
Advanced OOP For WordPress Part 9: Extensible Plugins Using the Plugins API
In this series on applying advanced object-oriented programming (OOP) principles to the PHP code we use in WordPress plugins, we are creating a plugin that modifies how REST API routes work to improve their search capabilities. One of the great things about WordPress is its extensibility. In this post, I’m going to walk through using the improvements made in the last article. In this series to make the plugin extensible, Tonya Mork of Know The Code is writing code review articles in this series. The last article I wrote was all about making the search system swappable. The changes I’m […]
Advanced OOP For WordPress Part 8: Developing New Features For Extensible WordPress Plugins Using Test-Driven Development
In my last post in this series on advanced PHP object-oriented programming for WordPress development, I walked through refactoring the low-level API of a plugin, using tests to guide the process and make sure everything works correctly. I say “low-level API” because the focus was on the internal of how the system will work. I didn’t cover too much of wiring things together. In this article, that’s where this post picks up. The next step was to create a factory that takes an array of arguments for the REST API to add, and an array of post types — that […]
Advanced OOP For WordPress Part 7: Refactoring Is An Opportunity To Adopt Test-Driven Development
So far in this series on writing WordPress plugins using object-oriented PHP, I’ve focused mainly on testing. This is because a key advantage of object-oriented PHP is that it can be written in a way that is both highly testable and highly reusable. Just using classes doesn’t magically give us this We’ve also not written any code that does something practically useful. The idea is to show how to customize search via the WordPress REST API. The example plugin, at the point where I’ve left off just returns an array of WP_Posts. But, the public API for the system is […]
How WordPress Can Lead the Web in Privacy-First Design
In May of 2018, WordPress 4.9.6 was released with new privacy-related features to aid in compliance with the new EU privacy regulations known as the GDPR. The GDPR grants EU citizens the right to request what data a website can collect, and request that it be erased. It also requires informed consent of how the data will be used and shared with third parties. Every WordCamp I’ve been to since the last US election I’ve had multiple conversations about why corporate surveillance states, like those created by analytics collection, PPC platforms, etc, are in general dangerous, especially when used for […]
Advanced OOP For WordPress Part 6: Continuous Integration For WordPress Plugins
This article is a part of a series on writing object-oriented PHP for WordPress development. So far, we’ve spent two articles on writing the code and now we will test the code and systems. It takes an enormous amount of tooling to write code and back in my day I walked uphill both ways, in two feet of snow, to write HTML, using HTML instead of writing it in Babel and transferring it to HTML. Yes, it’s a lot, but that’s why we have scaffolding tools, and we’re going to get into some of those in this article. Object-oriented programming […]
3 Comments