betterpress/wordpress-adapter

There is no license information available for the latest version (v1.1.0) of this package.

OO adapters/wrappers around low-level wordpress functions

v1.1.0 2015-02-04 17:11 UTC

This package is auto-updated.

Last update: 2024-04-25 05:53:34 UTC


README

This package is an object-oriented layer around some of Wordpress' low-level API. Hooks are currently implemented.

Although you can use this package directly, it's more likely you'll want to use it as part of wordpress-symfony-edition as this will allow for much less verbose code.

Usage

<?php

class MyHook implements Hook
{
    public function execute(HookContext $context)
    {
        // your hook code.. 
    }
}

use Betterpress\Wordpress\Adapter\Hooks\HookManager;
use Betterpress\Wordpress\Adapter\Hooks\HookConfiguration;

$manager = new HookManager();

$hook = new MyHook();

$manager->add(
    new HookConfiguration(HookConfiguration::ACTION, 'publish_post', $hook)
);