Skip to content

A starter lib for wordpress themes

Notifications You must be signed in to change notification settings

oakwood/wp-theme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Oakwood Wordpress Theme Framework

Latest Stable Version Total Downloads License

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

About

A starter lib for wordpress themes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages