Here, we finalize the updated version of the WordPress Widget Boilerplate by updating what users see on the front-end and by working with caching.Read More
WordPress Widgets API
We’re going to working on the area of the code that renders information for the user on the public-facing area of the site.
Why, then, does WordPress show one thing in the database and one thing in the administration area? This has to do with the widget cache.
And now, we start adding sanitization and serialization functionality into the WordPress Widget Boilerplate.
We want to make sure that we’re staying consistent with maintaining a high level of cohesion with our classes starting with WordPress widgets administration.
We’ll start breaking apart the various components that go into making up WordPress widgets starting with the administrative area.
The problem with WP_Widget is that it’s a lot of work for a single class to do. So we’ll start refactoring it now.
There’s a problem we’re facing with namespaces and autoloading and that’s what we’re going to look at in this post.
Once we have a Registry, we need to be able to access it throughout our plugin and we do that with custom hooks.
One problem that still exists in the code as it stands right now is that the WordPress widget’s constructor is registering functions and this isn’t a good thing.