WP Hooks is a base class that allows you to quickly and easily create WordPress plugins or extend WordPress via actions & filter hooks, shortcodes, and registration events.
PHP
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test/plugin-example
.gitignore
composer.json
composer.lock
readme.md

readme.md

WP-Hooks

WP-Hooks is a base class that minimizes the overhead of creating WordPress plugins and functions. Get straight to writing code that matters: your plugin's behaviors! WP-Hooks lets you quickly and easily create WordPress plugins and extend WordPress via actions, filters, shortcodes, and registration events. Simply create a class that extends the WP_Hooks class and start defining functions for the given action, filter, shortcode or registration event. Using this OOP technique for object based 'event like' programming saves you lines of code and increases clarity by focusing on just your custom functionality and behaviors.

Features:

  • Create actions and filters by implementing the given method - function wp_head() {...
  • Specify priorities via postfixing an underscore and numeric - function wp_head_10() {...
  • Create shortcodes by just prefixing your function - function shortcode_hello() {...
  • Implement behaviors for plugin de/activation, and uninstall - function activation() {...
  • Support non-PHP friendly action hooks that contain dash or slashes (bbPress)

Usage

See the example in test/plugin-example. Use "composer install" and the autoloader to include wp-hooks.php and gstring.php files in your plugin or WordPress theme. To prevent naming collisions and increase efficiency, make use of private function declarations in your class to avoid inadvertently hooking an existing action/filter hook.

License & Copyright

WP-Hooks is Copyright Stephen Carnam 2016, and is offered under the terms of the GNU General Public License, version 2. The GString object definition, including parsing functions delLeftMost, getLeftMost, delRightMost, getRightMost, etc. are also offered under terms of the GNU General Public License, version 2 and is available in PHP, Java, JavaScript, ActionScript, Lingo, Visual Basic, RealStudio, Perl, VBScript, AppleScript and even MySQL! Please contact me for non-GPL, commercial licensing.

Change Log

Version 1.1.0

  • Now Composer ready and PHP7 friendly; See test/plugin-example.