PHP code example of wp-media / event-manager
1. Go to this page and download the library: Download wp-media/event-manager library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wp-media / event-manager example snippets
use WPMedia\EventManager\EventManager;
use WPMedia\EventManager\PluginApiManager;
$event_manager = new EventManager(new PluginApiManager());
$event_manager->add_subscriber(new YourEventSubscriber());
use WPMedia\EventManager\SubscriberInterface;
class YourEventSubscriber implements SubscriberInterface
{
public static function get_subscribed_events(): array
{
return [
'init' => 'on_init',
'wp_enqueue_scripts' => ['on_enqueue_scripts', 10],
];
}
public function on_init()
{
// Handle init hook
}
public function on_enqueue_scripts()
{
// Handle script enqueuing
}
}