WordPress函数文档add_post_type_support()

注册一个自定义的页面类型 描述 Registers support of certain feature(s)…

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

描述

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.

用法

<?php add_post_type_support$post_type$supports ?>

参数

$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

注意

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

历史

  • 添加于 版本 3.0

源文件

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

相关

Post Types:
register_post_type(),
add_post_type_support(),
remove_post_type_support(),
post_type_supports(),
post_type_exists(),
set_post_type(),
get_post_type(),
get_post_types(),
get_post_type_object(),
get_post_type_capabilities(),
get_post_type_labels(),
is_post_type_hierarchical(),
is_post_type_archive(),
post_type_archive_title()

  • 原文:http://codex.wordpress.org/Function_Reference/add_post_type_support
类别:WordPress函数文档

本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论 (0)COMMENT