定制 elcontraption/wp-post-type 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

elcontraption/wp-post-type

最新稳定版本:0.2.0

Composer 安装命令:

composer require elcontraption/wp-post-type

包简介

A WordPress custom post type creator class.

README 文档

README

A WordPress custom post type creator class.

Installation

Via composer:

composer require elcontraption/wp-post-type

Create a post type

Create an 'event' post type:

use \ElContraption\WpPostType\PostType;

$events = new PostType('event');

The first argument may either be a string representing the name of the post type (typically singular), or an array defining singular, and plural names:

$events = new PostType(array(

    // These are required when passing an array for the first parameter
    'singular' => 'Gallery',
    'plural' => 'Galleries',

    // Optional
    'name' => 'gallery'
));

Labels

Labels are assigned based on the singular and plural names. You may override any post type label by passing an array of labels for the second parameter:

$labels = array(

    // Override the 'add_new' label
    'add_new' => 'My Custom Label'
);

$events = new PostType('event', $labels);

Arguments

The default WordPress post type arguments are respected, which means your custom post type will not be public by default see defaults. You may set your own arguments by passing an array for the third parameter:

$args = array(

    // Make this post type public
    'public' => true
);

$events = new PostType('event', $labels, $args);

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

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