[WordPress] WordPress Widgets: Refactoring, Part 5
<?php | |
namespace WordPressWidgetBoilerplate; | |
use WordPressWidgetBoilerplate\Utilities\Registry; | |
// More to come... |
<?php | |
// Setup a filter so we can retrieve the registry throughout the plugin. | |
$registry = new Registry(); | |
add_filter('wpWidgetRegistry', function () use ($registry) { | |
return $registry; | |
}); |
<?php | |
// Retrieve the registry anywhere in the plugin. | |
$registry = apply_filters('wpWidgetRegistry', null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment