承接 jjgrainger/posttypes 相关项目开发

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

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

jjgrainger/posttypes

最新稳定版本:v2.2.1

Composer 安装命令:

composer require jjgrainger/posttypes

包简介

Simple WordPress custom post types.

README 文档

README

tests codecov Latest Stable Version Total Downloads License

Simple WordPress custom post types.

Requirements

Installation

Install with composer

Run the following in your terminal to install PostTypes with Composer.

$ composer require jjgrainger/posttypes

PostTypes uses PSR-4 autoloading and can be used with the Composer's autoloader. Below is a basic example of getting started, though your setup may be different depending on how you are using Composer.

require __DIR__ . '/vendor/autoload.php';

use PostTypes\PostType;

$books = new PostType( 'book' );

$books->register();

See Composer's basic usage guide for details on working with Composer and autoloading.

Basic Usage

Below is a basic example of setting up a simple book post type with a genre taxonomy. For more information, check out the online documentation here.

// Require the Composer autoloader.
require __DIR__ . '/vendor/autoload.php';

// Import PostTypes.
use PostTypes\PostType;
use PostTypes\Taxonomy;

// Create a book post type.
$books = new PostType( 'book' );

// Attach the genre taxonomy (which is created below).
$books->taxonomy( 'genre' );

// Hide the date and author columns.
$books->columns()->hide( [ 'date', 'author' ] );

// Set the Books menu icon.
$books->icon( 'dashicons-book-alt' );

// Register the post type to WordPress.
$books->register();

// Create a genre taxonomy.
$genres = new Taxonomy( 'genre' );

// Set options for the taxonomy.
$genres->options( [
    'hierarchical' => false,
] );

// Register the taxonomy to WordPress.
$genres->register();

Notes

Author

Joe Grainger

统计信息

  • 总下载量: 537.18k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 381
  • 点击次数: 1
  • 依赖项目数: 15
  • 推荐数: 1

GitHub 信息

  • Stars: 373
  • Watchers: 20
  • Forks: 46
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-16