承接 azi/raskoh 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

azi/raskoh

最新稳定版本:1.4.1

Composer 安装命令:

composer require azi/raskoh

包简介

Raskoh - easy wordpress CPT and Taxonomy registration

README 文档

README

Registring custom post types and taxonomies in wordpress is not a headache anymore. Raskoh will make your life simpler.

Usage in theme functions.php

Install

You can insall Raskoh as a wordpress plugin by downloading the package and pulling it in wp-content/plugins folder or using composer.

Paste this in composer.json file

{
   "require" : {
        "azi/raskoh" : "1.*"
   }
}

or just run this command in your project. $ composer require azi/raskoh

include composers autoloader in your theme's functions.php

require_once "vendor/autoloader.php";

Usage

Register a Post Type

to register a post type

$music = new Raskoh\PostType("Music");
$music->register();
Add a Taxonomy

register a taxonomy along with post type

$music = Raskoh\PostType::getInstance("Music");
$music->taxonomy('Singer')->register();
Restrict Posts by Term

if you want to add Terms dropdown on WordPress admin interface to restrict posts by terms. just pass a second boolean to php PostType::taxonomy($name, $filters = false) method.

$music = Raskoh\PostType::getInstance("Music");
$music->taxonomy('Singer', true)->register();
Register Multiple Taxonomies
$music = Raskoh\PostType::getInstance("Music");
$music->taxonomy(['singer','genre'])->register();
Set Icons

you can also set icons to your post type

$music = Raskoh\PostType::getInstance("Music");
$music->taxonomy('Singer')->setIcon('dashicons-format-audioy')->register();

you can pass all other arguments listed at Codex for wp_register_post_type() like this

$CPT = Raskoh\PostType::getInstance();
$CPT->set{ArgumentName}

统计信息

  • 总下载量: 179
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-19