garung/custompostype

为WordPress创建自定义文章类型

1.1 2017-05-11 15:55 UTC

This package is not auto-updated.

Last update: 2024-09-15 02:57:54 UTC


README

自定义文章类型

描述:为WordPress创建简单的自定义文章类型

参数

演示
/**
 * Class handle for Product Custom Post Type
 */
class ProductCustomPost
{
    public function __construct()
    {
        $fields = [
            'posttype'          => 'product',
            'posttype_label'    => 'Sản Phẩm',
            'posttype_singular' => 'Sản Phẩm',
            'posttype_slug'     => 'product',
            'taxonomy_type'      => 'category-product',
            'taxonomy_label'     => 'Categories',
            'taxonomy_singular'  => 'Product Category',
            'taxonomy_slug'      => 'category-product',
        ];
        new CustomPost($fields);
    }
}

Note important: After create custom post type successful, you need update permalink by: Setting => permalink