owc / wp-theme
WordPress 主题的入门库
dev-master
2015-08-25 08:52 UTC
Requires
- php: >=5.4.0
- composer/installers: ~1.0
This package is not auto-updated.
Last update: 2024-09-28 16:20:42 UTC
README
安装
将 owc/wp-theme
添加到 composer.json
中的需求
{ "require": { "owc/wp-theme": "dev-master" } }
使用 composer update
更新您的包或使用 composer install
安装。
您还可以使用 composer require owc/wp-theme
添加该包,并稍后指定您想要的版本(目前,dev-master
是最佳选择)。
文档
入门
Oakwood WordPress 主题框架提供了 3 个主要抽象类以扩展
Oakwood\AbstractTheme; # Handles theme related filters, actions & functions Oakwood\AbstractAdmin; # Handles Wordpress admin related filters, actions & functions Oakwood\AbstractCron; # Handles background jobs for Wordpress
主题
要实现主题类,在您的主题中扩展 Oakwood\AbstractTheme。最好放在 /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; } }
管理界面
要实现管理界面类,在您的主题中扩展 Oakwood\AbstractAdmin。最好放在 /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; } }
定时任务
尚未文档化