Docs: Improve documentation for variadic functions relating to post type support and theme support.

See #37402


git-svn-id: https://develop.svn.wordpress.org/trunk@45422 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2019-05-25 23:40:06 +00:00
parent f0daff8dbf
commit 13bd882529
2 changed files with 32 additions and 1 deletions

View File

@ -1742,7 +1742,7 @@ function _add_post_type_submenus() {
}
/**
* Register support of certain features for a post type.
* Registers support of certain features for a post type.
*
* All core features are directly associated with a functional area of the edit
* screen, such as the editor or a meta box. Features include: 'title', 'editor',
@ -1753,6 +1753,16 @@ function _add_post_type_submenus() {
* store revisions, and the 'comments' feature dictates whether the comments
* count will show on the edit screen.
*
* Example usage:
*
* add_post_type_support( 'my_post_type', 'comments' );
* add_post_type_support( 'my_post_type', array(
* 'author', 'excerpt',
* ) );
* add_post_type_support( 'my_post_type', 'my_feature', array(
* 'field' => 'value',
* ) );
*
* @since 3.0.0
*
* @global array $_wp_post_type_features
@ -1760,6 +1770,7 @@ function _add_post_type_submenus() {
* @param string $post_type The post type for which to add the feature.
* @param string|array $feature The feature being added, accepts an array of
* feature strings or a single string.
* @param mixed ...$args Optional extra arguments to pass along with certain features.
*/
function add_post_type_support( $post_type, $feature ) {
global $_wp_post_type_features;

View File

@ -2318,6 +2318,14 @@ function get_theme_starter_content() {
* If attached to a hook, it must be {@see 'after_setup_theme'}.
* The {@see 'init'} hook may be too late for some features.
*
* Example usage:
*
* add_theme_support( 'title-tag' );
* add_theme_support( 'custom-logo', array(
* 'height' => 480,
* 'width' => 720,
* ) );
*
* @since 2.9.0
* @since 3.6.0 The `html5` feature was added
* @since 3.9.0 The `html5` feature now also accepts 'gallery' and 'caption'
@ -2636,11 +2644,17 @@ function _custom_logo_header_styles() {
/**
* Gets the theme support arguments passed when registering that support
*
* Example usage:
*
* get_theme_support( 'custom-logo' );
* get_theme_support( 'custom-header', 'width' );
*
* @since 3.1.0
*
* @global array $_wp_theme_features
*
* @param string $feature The feature to check.
* @param mixed ...$args Optional extra arguments to be checked against certain features.
* @return mixed The array of extra arguments or the value for the registered feature.
*/
function get_theme_support( $feature ) {
@ -2751,11 +2765,17 @@ function _remove_theme_support( $feature ) {
/**
* Checks a theme's support for a given feature.
*
* Example usage:
*
* current_theme_supports( 'custom-logo' );
* current_theme_supports( 'html5', 'comment-form' );
*
* @since 2.9.0
*
* @global array $_wp_theme_features
*
* @param string $feature The feature being checked.
* @param mixed ...$args Optional extra arguments to be checked against certain features.
* @return bool True if the current theme supports the feature, false otherwise.
*/
function current_theme_supports( $feature ) {