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).
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
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;
}
}
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;
}
}
Not yet documented