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

See #37402

Built from https://develop.svn.wordpress.org/trunk@45422


git-svn-id: http://core.svn.wordpress.org/trunk@45233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2019-05-25 23:41:54 +00:00
parent e91bf3535c
commit 04bba79df9
3 changed files with 33 additions and 2 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 * 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', * 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 * store revisions, and the 'comments' feature dictates whether the comments
* count will show on the edit screen. * 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 * @since 3.0.0
* *
* @global array $_wp_post_type_features * @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 $post_type The post type for which to add the feature.
* @param string|array $feature The feature being added, accepts an array of * @param string|array $feature The feature being added, accepts an array of
* feature strings or a single string. * 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 ) { function add_post_type_support( $post_type, $feature ) {
global $_wp_post_type_features; 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'}. * If attached to a hook, it must be {@see 'after_setup_theme'}.
* The {@see 'init'} hook may be too late for some features. * 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 2.9.0
* @since 3.6.0 The `html5` feature was added * @since 3.6.0 The `html5` feature was added
* @since 3.9.0 The `html5` feature now also accepts 'gallery' and 'caption' * @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 * 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 * @since 3.1.0
* *
* @global array $_wp_theme_features * @global array $_wp_theme_features
* *
* @param string $feature The feature to check. * @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. * @return mixed The array of extra arguments or the value for the registered feature.
*/ */
function get_theme_support( $feature ) { function get_theme_support( $feature ) {
@ -2751,11 +2765,17 @@ function _remove_theme_support( $feature ) {
/** /**
* Checks a theme's support for a given 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 * @since 2.9.0
* *
* @global array $_wp_theme_features * @global array $_wp_theme_features
* *
* @param string $feature The feature being checked. * @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. * @return bool True if the current theme supports the feature, false otherwise.
*/ */
function current_theme_supports( $feature ) { function current_theme_supports( $feature ) {

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-45421'; $wp_version = '5.3-alpha-45422';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.