hasanart / moco-framework
WordPress 开发框架
0.2.6
2021-04-14 18:46 UTC
Requires
- php: >=7.0
- ext-json: *
README
WordPress 开发框架主题 & 插件选项
如何使用
使用 composer
如果您想在受管理环境中使用此扩展,只需使用 composer 进行安装
composer require hasanart/moco-framework
在主题或插件的 function.php 中包含供应商自动加载器
include('vendor/autoload.php');
在您的主题目录中使用
下载最新版本并将其复制到您的主题中
include('moco-framework/index.php');
使用安装插件
下载最新版本并将其复制到 wp-content/plugins 中,然后在插件列表中激活插件
使用框架
要使用 Moco 框架
use MocoFramework\Helper\Controls; //use Globa Variable global $moco_framework; // set your Tabs & option Controls $options = [ //tabs [ 'id' => 'general', 'title' => 'General', 'icon' => 'fa-dashboard', 'controls' => [ [ 'id' => 'Text Control', 'type' => Controls::Text, 'title' => 'wordpress test', 'desc' => 'wordpress test test', 'placeholder' => 'wordpress ...', 'default' => 'wordpress ...', 'detail' => 'wordpress detail' ], [ 'id' => 'js', 'type' => Controls::CodeEditor, 'title' => 'codeEditor', ], [ 'id' => 'wp_editor', 'type' => Controls::WpEditor, 'title' => 'Wp Editor', 'default' => 'defaul content with support html', ] ] ], //external tab link () [ 'id' => 'external', 'title' => 'External', 'icon' => 'fa-external', 'link' => 'https://wpdev.ir/', ] ]; //make new option page $moco_framework->option() ->setTitle('Moco Framework Options') ->setSubTitle('the best of options package') ->setMenu('Moco Options') ->setSlug('moco-options') ->setPosition(99) ->options($options);
子菜单
要使用 Moco 框架
use MocoFramework\Helper\Controls; //use Globa Variable global $moco_framework; // set your Tabs & option Controls $options = [ //tabs [ 'id' => 'general', 'title' => 'General', 'icon' => 'fa-dashboard', 'submenu' => [ [ 'id' => 'subGeneral', 'title' => 'Sub General', 'icon' => 'fa-dashboard', 'controls' => [ [ 'id' => 'Text Control', 'type' => Controls::Text, 'title' => 'wordpress test', 'desc' => 'wordpress test test', 'placeholder' => 'wordpress ...', 'default' => 'wordpress ...', 'detail' => 'wordpress detail' ], [ 'id' => 'js', 'type' => Controls::CodeEditor, 'title' => 'codeEditor', ], [ 'id' => 'wp_editor', 'type' => Controls::WpEditor, 'title' => 'Wp Editor', 'default' => 'defaul content with support html', ] ] ], ] ], //external tab link () [ 'id' => 'external', 'title' => 'External', 'icon' => 'fa-external', 'link' => 'https://wpdev.ir/', ] ]; //make new option page $moco_framework->option() ->setTitle('Moco Framework Options') ->setSubTitle('the best of options package') ->setMenu('Moco Options') ->setSlug('moco-options') ->setPosition(99) ->options($options);
获取选项值
global $moco_framework; $moco_framework->getOption('moco-options', 'logo','defautl logo url' );
为获取您自己的选项创建简单函数
function get_moco($option, $default = false){ global $moco_framework; return $moco_framework->getOption('moco-options', $option, $default ); }
待办功能
- 选项页面
- 元框
- 自定义选项
- 小工具
- 菜单选项
- 备份选项
- 更新主题或插件
- 许可主题或插件
待办字段
- 文本
- 文本区域
- 代码编辑器
- WordPress 编辑器
- 单选按钮
- 复选框
- 选择
- 选择媒体
- 开关
- Select2
- 标签
- 颜色选择器
- 日期选择器
- 可拖动