PHP code example of dbout / wp-hooks

1. Go to this page and download the library: Download dbout/wp-hooks 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/ */

    

dbout / wp-hooks example snippets


class InitHook extends \Dbout\WpHooks\Hookable\Hookable {

    protected string $hook = 'init';

    public function execute(): void 
    {
        // Do something
    }
}

$loader = new \Dbout\WpHooks\HooksLoader();
$loader->add(InitHook::class);

$loader->register();

$loader = new \Dbout\WpHooks\HooksLoader();
$loader
    ->add(InitHook::class)
    ->add(RegisterMenus::class)
    ->add(RegisterAssets::class);

$loader->register();

\Dbout\WpHooks\Facade\Action::add('init', 'InitHooks@callback');

\Dbout\WpHooks\Facade\Action::add('init', [new InitHooks(), 'callback']);