项目作者: palmtreephp

项目描述 :
:palm_tree: WordPress custom post type class
高级语言: PHP
项目地址: git://github.com/palmtreephp/wp-custom-post-type.git
创建时间: 2017-03-22T15:18:09Z
项目社区:https://github.com/palmtreephp/wp-custom-post-type

开源协议:MIT License

下载


:palm_tree: WordPress Custom Post Types

License

Library to assist in the creation of custom post types within WordPress.

Requirements

  • PHP >= 7.1

Installation

Use composer to add the package to your dependencies:

  1. composer require palmtree/wp-custom-post-type

Usage

Basic Usage

  1. <?php
  2. use Palmtree\WordPress\CustomPostType\CustomPostType;
  3. $project = new CustomPostType('project');
  4. $callToAction = new CustomPostType([
  5. 'post_type' => 'cta',
  6. 'public' => false,
  7. ]);

Advanced Usage

  1. <?php
  2. use Palmtree\WordPress\CustomPostType\CustomPostType;
  3. $project = new CustomPostType([
  4. 'post_type' => 'project',
  5. 'front' => 'my-projects',
  6. 'taxonomies' => [
  7. [
  8. 'name' => 'Project Tags',
  9. 'hierarchical' => false,
  10. ],
  11. [
  12. 'name' => 'Project Categories',
  13. 'singluar_name' => 'Project Category',
  14. ]
  15. ],
  16. ]);

License

Released under the MIT license