You should be well-versed in the refactoring we’re doing regarding the WordPress Widget Boilerplate. If not, I recommend catching up on the series thus far by:
As far as the code base goes, we’re in a good place right now. We’ve begun to refactor much of the code into smaller, more focused classes. And we’ve just set up a Registry so that we can begin working with instances of objects throughout the plugin without the need for too much coupling.
But there’s still a problem we’re facing and it deals with namespaces and autoloading. I’ve talked a bit about this a couple of years ago but not as it relates to Composer.
And that’s what we’re going to look at in this post.
Continue reading “WordPress Widgets: Refactoring, Part 6 There’s a problem we’re facing with namespaces and autoloading and that’s what we’re going to review.“
When you’re working with a collection in PHP, most notably, arrays in PHP, there are two ways in which you primarily see the information manipulated:
- through a variety of the
array functions that PHP provides.
For what it’s worth, I think the
array functions provide greater readability but they have been shown to be slower (especially with larger data – with smaller data, it’s naturally going to be negligible).
I often work with
for loops and related functions to achieve the same thing but I thought it might be worth look at an example from the previous post and how I used the
array functions to achieve the same things as a
Ultimately, this is is a comparison post but I think it’s good to see how the same code can be written in different ways.
Continue reading “Writing Loops in PHP: Two Ways; Same Thing This is is a comparison post but I think it’s good to see how the same code can be written in different ways.“
When it comes to Bitbucket and GitHub, each offers their advantages and disadvantages. I’ve used them both and like them each for different reasons.
But I prefer GitHub for a few more reasons than Bitbucket (the least of which is not that my organization was hosted there). And I like to have everything, more or less, under the same service.
I’ve spent some time over the past week migrating from Bitbucket to GitHub. I currently maintain two personal accounts:
- one for myself,
- one for Pressware.
I’ve opted to downgrade my organization account to a personal account to save money and because I’m more or a less a company of one who occasionally has collaborators.
Various guides online leave something to be desired when it comes to walking through how to go about migrating from Bitbucket to Github, so I thought I’d share my experience for doing that.
Continue reading “Migrating From Bitbucket to GitHub: The Complete Guide With GitHub now offering free private repositories, you may want to consider migrating from Bitbucket to GitHub.“
In the previous post, we created a Registry that is going to be used to store all of the various classes responsible for giving our widget its functionality.
To do this, there’s going to be a variety of other classes introduced, but before going there, we need to add the Registry to the plugin’s bootstrap (let alone create a bootstrap for the plugin).
Specifically, here’s where we left off:
As mentioned earlier in the post, we need to add this to the bootstrap of the plugin. To do this, though, we need to define our own filter so that we can easily pass the registry around the rest of the plugin (when the time comes to do that).
So in this post, we’re going to focus on doing exactly that.
Continue reading “WordPress Widgets: Refactoring, Part 5 Once we have a Registry, we need to be able to access it throughout our plugin and we do that with custom hooks.“
Whenever you’re building a plugin that introduces a submenu, and you’re using the proper APIs, you’re going to be creating an administration page (whether or not it has settings).
When doing this, though, you can also introduce a plugin settings link. These are the links that appear under the name of the plugin from in the plugin dashboard.
If your plugin introduces its submenu item, then it likely introduces its own settings page. And if you’re looking to associate this page with your plugin settings link, it’s really easy to do.
Continue reading “Adding a Plugin Settings Link If you’re looking to introduce your plugin settings link, it’s really easy to do.“