PHP code example of lidmo / wp-plugin-start

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

    

lidmo / wp-plugin-start example snippets


namespace PluginName\Hooks\Wp;

use Lidmo\WP\Foundation\Hooks\Hook;

class EnqueueScriptsAction extends Hook
{

    public function handle()
    {
        // your code here
    }
}

namespace PluginName\Hooks\Wp;

use Lidmo\WP\Foundation\Hooks\Hook;

class InsertPostDataFilter extends Hook
{
    public function handle($attributes)
    {
        // your code here
    }
}

namespace PluginName\Hooks;

use Lidmo\WP\Foundation\Hooks\Kernel as HooksKernel;

class Kernel extends HooksKernel
{
    protected $hooks = [
        // Actions
        \PluginName\Hooks\Wp\EnqueueScriptsAction::class,

        // Filters
        \PluginName\Hooks\Wp\InsertPostDataFilter::class,
    ];
}

protected $name = 'hook_name'; // set hook name
protected $type = 'filter'; // set hook filter
protected $priority = 100; // set hook priority
protected $acceptedArgs = 1; // set hook args