wenprise/content-types

更轻松地创建WordPress内容类型和分类法。

3.0.0 2023-11-15 08:33 UTC

README

更轻松地创建WordPress内容类型和分类法。

注册文章类型

 \WenpriseContentTypes\ContentType::register( "work", "Works", [ 'title', 'editor', 'thumbnail'], true, false, 'dashicons-art' );

参数

 @param string  $name         Post type name in the menu and page title
 @param array|boolean   $support      The functions post type support
 @param boolean $is_publish   Is publish in frontend
 @param boolean $hierarchical is hierarchical
 @param string  $icon         the dashicon of the dashboard menu

过滤器

  • wprs_type_labels_$slug: 修改文章类型标签
  • wprs_type_args_$slug: 修改注册文章类型的参数

注册分类法

\WenpriseContentTypes\Taxonomy::register( "work_type", 'work', "Work Type", true );

参数

@param string       $tax_slug     Taxonomy slug
@param string|array $post_type    the post type of the taxonomy registered to 
@param string       $tax_name     Taxonomy name 
@param boolean      $hierarchical is hierarchical

过滤器

  • wprs_type_labels_$slug: 修改文章类型标签
  • wprs_type_args_$slug: 修改注册文章类型的参数
  • wprs_tax_types_$slug: 修改注册到文章类型的分类法