owc / wp-theme
A starter lib for wordpress themes
Requires
- php: >=5.4.0
- composer/installers: ~1.0
This package is not auto-updated.
Last update: 2024-04-13 14:02:44 UTC
README
Installation
Add owc/wp-theme
as a requirement to composer.json
:
{ "require": { "owc/wp-theme": "dev-master" } }
Update your packages with composer update
or install with composer install
.
You can also add the package using composer require owc/wp-theme
and later specifying the version you want (for now, dev-master
is your best bet).
Documentation
Getting Started
Oakwood Wordpress Theme Framework offers 3 main abstract classes to extend:
Oakwood\AbstractTheme; # Handles theme related filters, actions & functions Oakwood\AbstractAdmin; # Handles Wordpress admin related filters, actions & functions Oakwood\AbstractCron; # Handles background jobs for Wordpress
Theme
To implement the Theme class extend Oakwood\AbstractTheme in you theme. Preferably in /wp-content/themes/[your-theme]/src/[your-namespace]/Theme.php
namespace MyNamespace; class Theme extends \Oakwood\AbstractTheme { public function get_filters( $filters = array() ) { // $filters['wordpress_filter'] => 'my_filter'; // return your custom theme filters return $filters; } public function get_actions( $actions = array() ) { // $actions['wordpress_action'] => 'my_action'; // return your custom theme actions return $actions; } public function get_widgets( $widgets = array() ) { // $widgets['MyWidget'] => true; // return your custom theme widgets return $widgets; } public function get_styles( $styles = array() ) { // $styles['my_css'] => 'path/to/my/css'; // return your custom theme styles return $styles; } public function get_scripts( $scripts = array() ) { // $scripts['my_js'] => 'path/to/my/js'; // return your custom theme scripts return $scripts; } }
Admin
To implement the Admin class extend Oakwood\AbstractAdmin in you theme. Preferably in /wp-content/themes/[your-theme]/src/[your-namespace]/Admin.php
namespace MyNamespace; class Admin extends \Oakwood\AbstractAdmin { public function get_filters( $filters = array() ) { // $filters['wordpress_filter'] => 'my_filter'; // return your custom theme filters return $filters; } public function get_actions( $actions = array() ) { // $actions['wordpress_action'] => 'my_action'; // return your custom theme actions return $actions; } }
Cron
Not yet documented