From 13bd882529fc6a01cfd872310f211d8576c125e0 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 25 May 2019 23:40:06 +0000 Subject: [PATCH] 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 --- src/wp-includes/post.php | 13 ++++++++++++- src/wp-includes/theme.php | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index ac29d9628f..54e6c14f3b 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -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; diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 1682fdbdab..b6b0989a3e 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -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 ) {