GithubHelp home page GithubHelp logo

devenc / ashuwp_framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ashuwp/ashuwp_framework

0.0 1.0 0.0 114 KB

使用Ashuwp Framework框架可以给wordpress添加设置页面、文章字段、分类字段。

Home Page: http://www.ashuwp.com/framework/down

License: GNU General Public License v3.0

PHP 82.98% CSS 6.41% JavaScript 10.61%

ashuwp_framework's Introduction

Ashuwp_framework

简介

Ashuwp_framework是由阿树工作室发布的一个wordpress后台框架。

*最新版本 6.5 *更新日期 2018.07.30 *系统要求 php5.3以上 *WordPress版本 4.5以上

使用本框架的要求:你需要具备基础的php语法知识,以及对wordpress主题有基本的了解。

本框架的功能

  • 给wordpress文章添加自定义字段
    • 支持自定义文章类型
    • 6.0以上版本支持快速编辑
  • 给wordpress主题后台添加设置页面
    • 支持多个顶级页面及子页面
    • 支持设置选项的导入导出
  • 给wordpress的分类添加自定义字段
    • 支持tag等自定义分类法

使用方法

  1. 将ashuwp_framework整个文件夹复制到主题中。
  2. 将add-functions.php文件的两句加载框架范例代码复制到主题的functions.php文件中。
  3. 根据实际需求编辑配置数据。
  4. 完成了,去后台看看。

帮助支持

Introductions

Ashuwp_framework is a framework for wordpress theme, Help developers to add options page/post metabox/term metabox for wordpress theme quickly and easily.

Usage

  1. Upload the folder ashuwp_framework into your theme.
  2. Copy the code in add-functions.php into your functions.php.
  3. OK,the framework worked.
  4. Edit the ashuwp_framework/config-example.php.

Help

配置数据

添加文章自定义字段

$meta_conf = array(
  'title' => 'Meta Title',
  'id'=>'example_box',
  'page'=>array('page','post'), //post type
  'context'=>'normal',
  'priority'=>'low'
);

$ashu_meta = array();

$ashu_meta[] = array(
  'name' => 'Input Example',
  'id'   => 'text_example',
  'desc' => 'A text input example, Default content:"Hello ashuwp."',
  'std'  => 'Hello ashuwp.',
  'type' => 'text'
);

/**More config array **/

$new_box = new ashuwp_postmeta_feild($ashu_meta, $meta_conf);

添加分类字段

$taxonomy_cof = array('category','post_tag'); // taxonomy

$ashu_feild = array();
$ashu_feild[] = array(
  'name'      => 'Text Example',
  'id'        => 'text_example',
  'desc'      => 'description or notice.Default content:Default content',
  'std'       => 'Default content',
  'edit_only' => false,
  "type"      => "text"
);

/**More config array **/

$ashuwp_termmeta_feild = new ashuwp_termmeta_feild($ashu_feild, $taxonomy_cof);

添加设置页面

$page_info = array(
  'full_name' => 'General Options',
  'optionname'=>'general', //
  'child'=>false, 
  'filename' => 'generalpage'
);

$ashu_options = array();

$ashu_options[] = array(
  'name' => 'Input Example',
  'id'   => 'input_example',
  'desc' => 'description or notice',
  'std'  => 'Default content',
  'type' => 'text'
);

/**More config array **/

$option_page = new ashuwp_options_feild($ashu_options, $page_info);

数据获取

文自定义字段

  1. 使用get_post_meta函数获取数据。
  2. 由于框架支持输入框组合使用,以及输入框动态增加,所以获取的数据有可能是二维数组或者三维数组。
  3. 请先确认获取的数据类型,可使用var_dump函数打印查看。

分类自定义字段

  1. 使用get_term_meta函数获取数据。
  2. 由于框架支持输入框组合使用,以及输入框动态增加,所以获取的数据有可能是二维数组或者三维数组。
  3. 请先确认获取的数据类型,可使用var_dump函数打印查看。

设置数据

  1. 一个设置页面的所有数据以多维数组形式在数据库中只保存一条数据。
  2. 为了与其它可能的插件区分,设置数据在保存的时候加了前缀。
  3. 使用get_option函数可以获取数据。 范例:
//设置页面配置'optionname'=>'general'
$general_option = get_option( 'ashuwp_general' );

// $general_option是多维数组
// 若不确定结构,可使用var_dump打印数据结构
var_dump( $general_option );

捐助我

  • 如果您觉得Ashuwp Framework对您wordpress开发有帮助,你还可以扫码捐助支持我。

image

ashuwp_framework's People

Contributors

ashuwp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.