Extending WP Pusher

The core of WP Pusher is built around a dependency container and is therefore very extendible. The container makes it super simple to add new dependencies or replace existing ones. WP Pusher also has a few hooks that you can hook into if you want to build an extension to the plugin.

Hooks

WP Pusher has 4 event hooks that are useful if you are building an extension, such as the WP Pusher Slack extension. The 4 hooks are:

  • wppusher_plugin_was_installed
  • wppusher_theme_was_installed
  • wppusher_plugin_was_updated
  • wppusher_theme_was_updated

The plugin hooks return a plugin file object and the theme hooks return a stylesheet object. Here's how one of them is used in the Slack notifications plugin:

The container

The WP Pusher container is a typical dependency injection container. It has 2 public methods, bind() to add a new dependency and make() to create a new dependency. When registering a dependency, you should use the "wppusher_register_dependency" hook. As an example, let's say we wanted to build a WP Pusher extension that could install plugins and themes from Dropbox. Here's how that could be done:

Note: This is very technical and you definitely don't need to understand any of this to use WP Pusher! :-) Also, if you are building something like this for WP Pusher, you should definitely reach out, so we could discuss and brainstorm it together! 💪

Need any help?

If you have any questions about WP Pusher, Git or WordPress, our email is hi@wppusher.com. Don't hesitate shooting us a message! You can also click the little ❤️ in the corner of this page.