add_post_type_support()注册一个自定义的页面类型

目录

描述

Registers support of certain feature(s) for a given post type. Each feature has a direct impact on the corresponding field displayed in the post edit screen, such as the editor or a meta box. Additionally, the 'revisions' feature dictates whether the post type will store revisions, and the 'comments' feature dictates whether the comments count will show on the post edit screen.

add_post_type_support() 描述

用法

<?php add_post_type_support$post_type$supports ?>

add_post_type_support() 用法

参数

$post_type

(string) (必填) Post type. (max. 20 characters)

默认值: None

$supports

(string/array) (必填) Feature to add.

  • 'title'
  • 'editor' (content)
  • 'author'
  • 'thumbnail' (featured image) (current theme must also support Post Thumbnails)
  • 'excerpt'
  • 'trackbacks'
  • 'custom-fields'
  • 'comments' (also will see comment count balloon on edit screen)
  • 'revisions' (will store revisions)
  • 'page-attributes' (template and menu order) (hierarchical must be true) (the page template selector is only available for the page post type)
  • 'post-formats' add post formats, see Post Formats

默认值: None

add_post_type_support() 参数

注意

  • The function should be called using the init 动作 hook, like in the above example.

add_post_type_support() 注意

历史

  • 添加于 版本 3.0

add_post_type_support() 历史

源文件

add_post_type_support() 函数的代码位于 wp-includes/post.php.

add_post_type_support() 源文件

相关