Twenty Twenty: Add missing documentation for some filters.

Add missing `@since` tags for some functions.

Correct alignment of some `@param` tags.

Follow-up to [46271], [46278], [51304].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51322


git-svn-id: http://core.svn.wordpress.org/trunk@50931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-07-03 09:14:58 +00:00
parent bf92ee343c
commit af7a04318d
20 changed files with 214 additions and 62 deletions

View File

@ -11,6 +11,8 @@
/** /**
* Return a value for our partial refresh. * Return a value for our partial refresh.
* *
* @since Twenty Twenty 1.0
*
* @param {Object} partial Current partial. * @param {Object} partial Current partial.
* *
* @return {jQuery.Promise} Resolved promise. * @return {jQuery.Promise} Resolved promise.
@ -31,6 +33,8 @@
/** /**
* Override the refresh method. * Override the refresh method.
* *
* @since Twenty Twenty 1.0
*
* @return {jQuery.Promise} Resolved promise. * @return {jQuery.Promise} Resolved promise.
*/ */
refresh: function() { refresh: function() {
@ -55,6 +59,7 @@
/** /**
* Input attributes. * Input attributes.
* *
* @since Twenty Twenty 1.0
* @type {Object} * @type {Object}
*/ */
attrs: {}, attrs: {},
@ -62,6 +67,8 @@
/** /**
* Override the refresh method. * Override the refresh method.
* *
* @since Twenty Twenty 1.0
*
* @return {jQuery.Promise} Resolved promise. * @return {jQuery.Promise} Resolved promise.
*/ */
refresh: function() { refresh: function() {

View File

@ -646,6 +646,8 @@ twentytwenty.toggles = {
* *
* This implementation is coming from https://gomakethings.com/a-native-javascript-equivalent-of-jquerys-ready-method/ * This implementation is coming from https://gomakethings.com/a-native-javascript-equivalent-of-jquerys-ready-method/
* *
* @since Twenty Twenty 1.0
*
* @param {Function} fn Callback function to run. * @param {Function} fn Callback function to run.
*/ */
function twentytwentyDomReady( fn ) { function twentytwentyDomReady( fn ) {
@ -695,6 +697,8 @@ function twentytwentyToggleAttribute( element, attribute, trueVal, falseVal ) {
/** /**
* Toggle a menu item on or off. * Toggle a menu item on or off.
* *
* @since Twenty Twenty 1.0
*
* @param {HTMLElement} target * @param {HTMLElement} target
* @param {number} duration * @param {number} duration
*/ */
@ -796,6 +800,8 @@ function twentytwentyMenuToggle( target, duration ) {
/** /**
* Traverses the DOM up to find elements matching the query. * Traverses the DOM up to find elements matching the query.
* *
* @since Twenty Twenty 1.0
*
* @param {HTMLElement} target * @param {HTMLElement} target
* @param {string} query * @param {string} query
* @return {NodeList} parents matching query * @return {NodeList} parents matching query

View File

@ -6,6 +6,8 @@
* This is the source file for what is minified in the twentytwenty_skip_link_focus_fix() PHP function. * This is the source file for what is minified in the twentytwenty_skip_link_focus_fix() PHP function.
* *
* Learn more: https://git.io/vWdr2 * Learn more: https://git.io/vWdr2
*
* @since Twenty Twenty 1.0
*/ */
( function() { ( function() {
var isIe = /(trident|msie)/i.test( navigator.userAgent ); var isIe = /(trident|msie)/i.test( navigator.userAgent );

View File

@ -10,12 +10,16 @@
if ( ! class_exists( 'TwentyTwenty_Customize' ) ) { if ( ! class_exists( 'TwentyTwenty_Customize' ) ) {
/** /**
* CUSTOMIZER SETTINGS * CUSTOMIZER SETTINGS
*
* @since Twenty Twenty 1.0
*/ */
class TwentyTwenty_Customize { class TwentyTwenty_Customize {
/** /**
* Register customizer options. * Register customizer options.
* *
* @since Twenty Twenty 1.0
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object. * @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/ */
public static function register( $wp_customize ) { public static function register( $wp_customize ) {
@ -412,9 +416,8 @@ if ( ! class_exists( 'TwentyTwenty_Customize' ) ) {
/** /**
* Sanitization callback for the "accent_accessible_colors" setting. * Sanitization callback for the "accent_accessible_colors" setting.
* *
* @static
* @access public
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
*
* @param array $value The value we want to sanitize. * @param array $value The value we want to sanitize.
* @return array Returns sanitized value. Each item in the array gets sanitized separately. * @return array Returns sanitized value. Each item in the array gets sanitized separately.
*/ */
@ -436,7 +439,9 @@ if ( ! class_exists( 'TwentyTwenty_Customize' ) ) {
/** /**
* Sanitize select. * Sanitize select.
* *
* @param string $input The input from the setting. * @since Twenty Twenty 1.0
*
* @param string $input The input from the setting.
* @param object $setting The selected setting. * @param object $setting The selected setting.
* @return string The input from the setting or the default setting. * @return string The input from the setting or the default setting.
*/ */
@ -449,6 +454,8 @@ if ( ! class_exists( 'TwentyTwenty_Customize' ) ) {
/** /**
* Sanitize boolean for checkbox. * Sanitize boolean for checkbox.
* *
* @since Twenty Twenty 1.0
*
* @param bool $checked Whether or not a box is checked. * @param bool $checked Whether or not a box is checked.
* @return bool * @return bool
*/ */
@ -469,6 +476,8 @@ if ( ! class_exists( 'TwentyTwenty_Customize' ) ) {
if ( ! function_exists( 'twentytwenty_customize_partial_blogname' ) ) { if ( ! function_exists( 'twentytwenty_customize_partial_blogname' ) ) {
/** /**
* Render the site title for the selective refresh partial. * Render the site title for the selective refresh partial.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_customize_partial_blogname() { function twentytwenty_customize_partial_blogname() {
bloginfo( 'name' ); bloginfo( 'name' );
@ -478,6 +487,8 @@ if ( ! function_exists( 'twentytwenty_customize_partial_blogname' ) ) {
if ( ! function_exists( 'twentytwenty_customize_partial_blogdescription' ) ) { if ( ! function_exists( 'twentytwenty_customize_partial_blogdescription' ) ) {
/** /**
* Render the site description for the selective refresh partial. * Render the site description for the selective refresh partial.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_customize_partial_blogdescription() { function twentytwenty_customize_partial_blogdescription() {
bloginfo( 'description' ); bloginfo( 'description' );
@ -489,6 +500,8 @@ if ( ! function_exists( 'twentytwenty_customize_partial_site_logo' ) ) {
* Render the site logo for the selective refresh partial. * Render the site logo for the selective refresh partial.
* *
* Doing it this way so we don't have issues with `render_callback`'s arguments. * Doing it this way so we don't have issues with `render_callback`'s arguments.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_customize_partial_site_logo() { function twentytwenty_customize_partial_site_logo() {
twentytwenty_site_logo(); twentytwenty_site_logo();
@ -499,18 +512,22 @@ if ( ! function_exists( 'twentytwenty_customize_partial_site_logo' ) ) {
/** /**
* Input attributes for cover overlay opacity option. * Input attributes for cover overlay opacity option.
* *
* @since Twenty Twenty 1.0
*
* @return array Array containing attribute names and their values. * @return array Array containing attribute names and their values.
*/ */
function twentytwenty_customize_opacity_range() { function twentytwenty_customize_opacity_range() {
/** /**
* Filters the input attributes for opacity * Filters the input attributes for opacity.
*
* @since Twenty Twenty 1.0
* *
* @param array $attrs { * @param array $attrs {
* The attributes * The attributes.
* *
* @type int $min Minimum value * @type int $min Minimum value.
* @type int $max Maximum value * @type int $max Maximum value.
* @type int $step Interval between numbers * @type int $step Interval between numbers.
* } * }
*/ */
return apply_filters( return apply_filters(

View File

@ -12,6 +12,8 @@
if ( ! class_exists( 'TwentyTwenty_Non_Latin_Languages' ) ) { if ( ! class_exists( 'TwentyTwenty_Non_Latin_Languages' ) ) {
/** /**
* Language handling. * Language handling.
*
* @since Twenty Twenty 1.0
*/ */
class TwentyTwenty_Non_Latin_Languages { class TwentyTwenty_Non_Latin_Languages {
@ -20,7 +22,9 @@ if ( ! class_exists( 'TwentyTwenty_Non_Latin_Languages' ) ) {
* *
* Return CSS for non-latin language, if available, or null * Return CSS for non-latin language, if available, or null
* *
* @param string $type Whether to return CSS for the "front-end", "block-editor" or "classic-editor". * @since Twenty Twenty 1.0
*
* @param string $type Whether to return CSS for the "front-end", "block-editor", or "classic-editor".
* @return void * @return void
*/ */
public static function get_non_latin_css( $type = 'front-end' ) { public static function get_non_latin_css( $type = 'front-end' ) {
@ -28,7 +32,13 @@ if ( ! class_exists( 'TwentyTwenty_Non_Latin_Languages' ) ) {
// Fetch site locale. // Fetch site locale.
$locale = get_bloginfo( 'language' ); $locale = get_bloginfo( 'language' );
// Define fallback fonts for non-latin languages. /**
* Filters the fallback fonts for non-latin languages.
*
* @since Twenty Twenty 1.0
*
* @param array $font_family An array of locales and font families.
*/
$font_family = apply_filters( $font_family = apply_filters(
'twentytwenty_get_localized_font_family_types', 'twentytwenty_get_localized_font_family_types',
array( array(
@ -98,7 +108,13 @@ if ( ! class_exists( 'TwentyTwenty_Non_Latin_Languages' ) ) {
return; return;
} }
// Define elements to apply fallback fonts to. /**
* Filters the elements to apply fallback fonts to.
*
* @since Twenty Twenty 1.0
*
* @param array $elements An array of elements for "front-end", "block-editor", or "classic-editor".
*/
$elements = apply_filters( $elements = apply_filters(
'twentytwenty_get_localized_font_family_elements', 'twentytwenty_get_localized_font_family_elements',
array( array(

View File

@ -14,6 +14,8 @@
if ( ! class_exists( 'TwentyTwenty_Script_Loader' ) ) { if ( ! class_exists( 'TwentyTwenty_Script_Loader' ) ) {
/** /**
* A class that provides a way to add `async` or `defer` attributes to scripts. * A class that provides a way to add `async` or `defer` attributes to scripts.
*
* @since Twenty Twenty 1.0
*/ */
class TwentyTwenty_Script_Loader { class TwentyTwenty_Script_Loader {
@ -22,6 +24,8 @@ if ( ! class_exists( 'TwentyTwenty_Script_Loader' ) ) {
* *
* If #12009 lands in WordPress, this function can no-op since it would be handled in core. * If #12009 lands in WordPress, this function can no-op since it would be handled in core.
* *
* @since Twenty Twenty 1.0
*
* @link https://core.trac.wordpress.org/ticket/12009 * @link https://core.trac.wordpress.org/ticket/12009
* *
* @param string $tag The script tag. * @param string $tag The script tag.

View File

@ -12,10 +12,14 @@ if ( class_exists( 'WP_Customize_Control' ) ) {
if ( ! class_exists( 'TwentyTwenty_Separator_Control' ) ) { if ( ! class_exists( 'TwentyTwenty_Separator_Control' ) ) {
/** /**
* Separator Control. * Separator Control.
*
* @since Twenty Twenty 1.0
*/ */
class TwentyTwenty_Separator_Control extends WP_Customize_Control { class TwentyTwenty_Separator_Control extends WP_Customize_Control {
/** /**
* Render the hr. * Render the hr.
*
* @since Twenty Twenty 1.0
*/ */
public function render_content() { public function render_content() {
echo '<hr/>'; echo '<hr/>';

View File

@ -11,12 +11,16 @@ if ( ! class_exists( 'TwentyTwenty_SVG_Icons' ) ) {
/** /**
* SVG ICONS CLASS * SVG ICONS CLASS
* Retrieve the SVG code for the specified icon. Based on a solution in Twenty Nineteen. * Retrieve the SVG code for the specified icon. Based on a solution in Twenty Nineteen.
*
* @since Twenty Twenty 1.0
*/ */
class TwentyTwenty_SVG_Icons { class TwentyTwenty_SVG_Icons {
/** /**
* GET SVG CODE * GET SVG CODE
* Get the SVG code for the specified icon * Get the SVG code for the specified icon
* *
* @since Twenty Twenty 1.0
*
* @param string $icon Icon name. * @param string $icon Icon name.
* @param string $group Icon group. * @param string $group Icon group.
* @param string $color Color. * @param string $color Color.
@ -69,6 +73,8 @@ if ( ! class_exists( 'TwentyTwenty_SVG_Icons' ) ) {
* GET SOCIAL LINK SVG * GET SOCIAL LINK SVG
* Detects the social network from a URL and returns the SVG code for its icon. * Detects the social network from a URL and returns the SVG code for its icon.
* *
* @since Twenty Twenty 1.0
*
* @param string $uri The URL to retrieve SVG for. * @param string $uri The URL to retrieve SVG for.
*/ */
public static function get_social_link_svg( $uri ) { public static function get_social_link_svg( $uri ) {
@ -116,6 +122,7 @@ if ( ! class_exists( 'TwentyTwenty_SVG_Icons' ) ) {
* ICON STORAGE * ICON STORAGE
* Store the code for all SVGs in an array. * Store the code for all SVGs in an array.
* *
* @since Twenty Twenty 1.0
* @var array * @var array
*/ */
public static $ui_icons = array( public static $ui_icons = array(
@ -169,6 +176,7 @@ if ( ! class_exists( 'TwentyTwenty_SVG_Icons' ) ) {
* By default, each Icon ID is matched against a .com TLD. To override this behavior, * By default, each Icon ID is matched against a .com TLD. To override this behavior,
* specify all the domains it covers (including the .com TLD too, if applicable). * specify all the domains it covers (including the .com TLD too, if applicable).
* *
* @since Twenty Twenty 1.0
* @var array * @var array
*/ */
public static $social_icons_map = array( public static $social_icons_map = array(
@ -224,6 +232,7 @@ if ( ! class_exists( 'TwentyTwenty_SVG_Icons' ) ) {
/** /**
* Social Icons svg sources. * Social Icons svg sources.
* *
* @since Twenty Twenty 1.0
* @var array * @var array
*/ */
public static $social_icons = array( public static $social_icons = array(

View File

@ -11,12 +11,16 @@ if ( ! class_exists( 'TwentyTwenty_Walker_Comment' ) ) {
/** /**
* CUSTOM COMMENT WALKER * CUSTOM COMMENT WALKER
* A custom walker for comments, based on the walker in Twenty Nineteen. * A custom walker for comments, based on the walker in Twenty Nineteen.
*
* @since Twenty Twenty 1.0
*/ */
class TwentyTwenty_Walker_Comment extends Walker_Comment { class TwentyTwenty_Walker_Comment extends Walker_Comment {
/** /**
* Outputs a comment in the HTML5 format. * Outputs a comment in the HTML5 format.
* *
* @since Twenty Twenty 1.0
*
* @see wp_list_comments() * @see wp_list_comments()
* @see https://developer.wordpress.org/reference/functions/get_comment_author_url/ * @see https://developer.wordpress.org/reference/functions/get_comment_author_url/
* @see https://developer.wordpress.org/reference/functions/get_comment_author/ * @see https://developer.wordpress.org/reference/functions/get_comment_author/

View File

@ -11,14 +11,17 @@ if ( ! class_exists( 'TwentyTwenty_Walker_Page' ) ) {
/** /**
* CUSTOM PAGE WALKER * CUSTOM PAGE WALKER
* A custom walker for pages. * A custom walker for pages.
*
* @since Twenty Twenty 1.0
*/ */
class TwentyTwenty_Walker_Page extends Walker_Page { class TwentyTwenty_Walker_Page extends Walker_Page {
/** /**
* Outputs the beginning of the current element in the tree. * Outputs the beginning of the current element in the tree.
* *
* @since Twenty Twenty 1.0
*
* @see Walker::start_el() * @see Walker::start_el()
* @since 2.1.0
* *
* @param string $output Used to append additional content. Passed by reference. * @param string $output Used to append additional content. Passed by reference.
* @param WP_Post $page Page data object. * @param WP_Post $page Page data object.

View File

@ -30,6 +30,8 @@
* Note that this function is hooked into the after_setup_theme hook, which * Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such * runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails. * as indicating support for post thumbnails.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_theme_support() { function twentytwenty_theme_support() {
@ -183,6 +185,8 @@ require get_template_directory() . '/inc/block-patterns.php';
/** /**
* Register and Enqueue Styles. * Register and Enqueue Styles.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_register_styles() { function twentytwenty_register_styles() {
@ -203,6 +207,8 @@ add_action( 'wp_enqueue_scripts', 'twentytwenty_register_styles' );
/** /**
* Register and Enqueue Scripts. * Register and Enqueue Scripts.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_register_scripts() { function twentytwenty_register_scripts() {
@ -225,6 +231,8 @@ add_action( 'wp_enqueue_scripts', 'twentytwenty_register_scripts' );
* This does not enqueue the script because it is tiny and because it is only for IE11, * This does not enqueue the script because it is tiny and because it is only for IE11,
* thus it does not warrant having an entire dedicated blocking script being loaded. * thus it does not warrant having an entire dedicated blocking script being loaded.
* *
* @since Twenty Twenty 1.0
*
* @link https://git.io/vWdr2 * @link https://git.io/vWdr2
*/ */
function twentytwenty_skip_link_focus_fix() { function twentytwenty_skip_link_focus_fix() {
@ -237,7 +245,8 @@ function twentytwenty_skip_link_focus_fix() {
} }
add_action( 'wp_print_footer_scripts', 'twentytwenty_skip_link_focus_fix' ); add_action( 'wp_print_footer_scripts', 'twentytwenty_skip_link_focus_fix' );
/** Enqueue non-latin language styles /**
* Enqueue non-latin language styles.
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
@ -255,6 +264,8 @@ add_action( 'wp_enqueue_scripts', 'twentytwenty_non_latin_languages' );
/** /**
* Register navigation menus uses wp_nav_menu in five places. * Register navigation menus uses wp_nav_menu in five places.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_menus() { function twentytwenty_menus() {
@ -274,6 +285,8 @@ add_action( 'init', 'twentytwenty_menus' );
/** /**
* Get the information about the logo. * Get the information about the logo.
* *
* @since Twenty Twenty 1.0
*
* @param string $html The HTML output from get_custom_logo (core function). * @param string $html The HTML output from get_custom_logo (core function).
* @return string * @return string
*/ */
@ -331,14 +344,19 @@ if ( ! function_exists( 'wp_body_open' ) ) {
/** /**
* Shim for wp_body_open, ensuring backward compatibility with versions of WordPress older than 5.2. * Shim for wp_body_open, ensuring backward compatibility with versions of WordPress older than 5.2.
*
* @since Twenty Twenty 1.0
*/ */
function wp_body_open() { function wp_body_open() {
/** This action is documented in wp-includes/general-template.php */
do_action( 'wp_body_open' ); do_action( 'wp_body_open' );
} }
} }
/** /**
* Include a skip to content link at the top of the page so that users can bypass the menu. * Include a skip to content link at the top of the page so that users can bypass the menu.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_skip_link() { function twentytwenty_skip_link() {
echo '<a class="skip-link screen-reader-text" href="#site-content">' . __( 'Skip to the content', 'twentytwenty' ) . '</a>'; echo '<a class="skip-link screen-reader-text" href="#site-content">' . __( 'Skip to the content', 'twentytwenty' ) . '</a>';
@ -349,6 +367,8 @@ add_action( 'wp_body_open', 'twentytwenty_skip_link', 5 );
/** /**
* Register widget areas. * Register widget areas.
* *
* @since Twenty Twenty 1.0
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/ */
function twentytwenty_sidebar_registration() { function twentytwenty_sidebar_registration() {
@ -391,6 +411,8 @@ add_action( 'widgets_init', 'twentytwenty_sidebar_registration' );
/** /**
* Enqueue supplemental block editor styles. * Enqueue supplemental block editor styles.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_block_editor_styles() { function twentytwenty_block_editor_styles() {
@ -412,6 +434,8 @@ add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1
/** /**
* Enqueue classic editor styles. * Enqueue classic editor styles.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_classic_editor_styles() { function twentytwenty_classic_editor_styles() {
@ -429,6 +453,8 @@ add_action( 'init', 'twentytwenty_classic_editor_styles' );
* Output Customizer settings in the classic editor. * Output Customizer settings in the classic editor.
* Adds styles to the head of the TinyMCE iframe. Kudos to @Otto42 for the original solution. * Adds styles to the head of the TinyMCE iframe. Kudos to @Otto42 for the original solution.
* *
* @since Twenty Twenty 1.0
*
* @param array $mce_init TinyMCE styles. * @param array $mce_init TinyMCE styles.
* @return array TinyMCE styles. * @return array TinyMCE styles.
*/ */
@ -479,6 +505,8 @@ add_filter( 'tiny_mce_before_init', 'twentytwenty_add_classic_editor_non_latin_s
/** /**
* Block Editor Settings. * Block Editor Settings.
* Add custom colors and font sizes to the block editor. * Add custom colors and font sizes to the block editor.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_block_editor_settings() { function twentytwenty_block_editor_settings() {
@ -632,7 +660,7 @@ add_action( 'customize_preview_init', 'twentytwenty_customize_preview_init' );
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @param string $area The area we want to get the colors for. * @param string $area The area we want to get the colors for.
* @param string $context Can be 'text' or 'accent'. * @param string $context Can be 'text' or 'accent'.
* @return string Returns a HEX color. * @return string Returns a HEX color.
*/ */
@ -750,11 +778,11 @@ function twentytwenty_get_elements_array() {
); );
/** /**
* Filters Twenty Twenty theme elements * Filters Twenty Twenty theme elements.
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @param array Array of elements * @param array Array of elements.
*/ */
return apply_filters( 'twentytwenty_get_elements_array', $elements ); return apply_filters( 'twentytwenty_get_elements_array', $elements );
} }

View File

@ -12,12 +12,14 @@ if ( ! function_exists( 'twentytwenty_generate_css' ) ) {
/** /**
* Generate CSS. * Generate CSS.
* *
* @since Twenty Twenty 1.0
*
* @param string $selector The CSS selector. * @param string $selector The CSS selector.
* @param string $style The CSS style. * @param string $style The CSS style.
* @param string $value The CSS value. * @param string $value The CSS value.
* @param string $prefix The CSS prefix. * @param string $prefix The CSS prefix.
* @param string $suffix The CSS suffix. * @param string $suffix The CSS suffix.
* @param bool $echo Echo the styles. * @param bool $echo Echo the styles.
*/ */
function twentytwenty_generate_css( $selector, $style, $value, $prefix = '', $suffix = '', $echo = true ) { function twentytwenty_generate_css( $selector, $style, $value, $prefix = '', $suffix = '', $echo = true ) {
@ -50,7 +52,9 @@ if ( ! function_exists( 'twentytwenty_get_customizer_css' ) ) {
* Get CSS Built from Customizer Options. * Get CSS Built from Customizer Options.
* Build CSS reflecting colors, fonts and other options set in the Customizer, and return them for output. * Build CSS reflecting colors, fonts and other options set in the Customizer, and return them for output.
* *
* @param string $type Whether to return CSS for the "front-end", "block-editor" or "classic-editor". * @since Twenty Twenty 1.0
*
* @param string $type Whether to return CSS for the "front-end", "block-editor", or "classic-editor".
*/ */
function twentytwenty_get_customizer_css( $type = 'front-end' ) { function twentytwenty_get_customizer_css( $type = 'front-end' ) {
@ -78,7 +82,7 @@ if ( ! function_exists( 'twentytwenty_get_customizer_css' ) ) {
ob_start(); ob_start();
/** /*
* Note Styles are applied in this order: * Note Styles are applied in this order:
* 1. Element specific * 1. Element specific
* 2. Helper classes * 2. Helper classes
@ -86,7 +90,7 @@ if ( ! function_exists( 'twentytwenty_get_customizer_css' ) ) {
* This enables all helper classes to overwrite base element styles, * This enables all helper classes to overwrite base element styles,
* meaning that any color classes applied in the block editor will * meaning that any color classes applied in the block editor will
* have a higher priority than the base element styles. * have a higher priority than the base element styles.
*/ */
// Front-End Styles. // Front-End Styles.
if ( 'front-end' === $type ) { if ( 'front-end' === $type ) {

View File

@ -12,9 +12,11 @@ if ( ! function_exists( 'twentytwenty_the_theme_svg' ) ) {
* Output and Get Theme SVG. * Output and Get Theme SVG.
* Output and get the SVG markup for an icon in the TwentyTwenty_SVG_Icons class. * Output and get the SVG markup for an icon in the TwentyTwenty_SVG_Icons class.
* *
* @since Twenty Twenty 1.0
*
* @param string $svg_name The name of the icon. * @param string $svg_name The name of the icon.
* @param string $group The group the icon belongs to. * @param string $group The group the icon belongs to.
* @param string $color Color code. * @param string $color Color code.
*/ */
function twentytwenty_the_theme_svg( $svg_name, $group = 'ui', $color = '' ) { function twentytwenty_the_theme_svg( $svg_name, $group = 'ui', $color = '' ) {
echo twentytwenty_get_theme_svg( $svg_name, $group, $color ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in twentytwenty_get_theme_svg(). echo twentytwenty_get_theme_svg( $svg_name, $group, $color ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in twentytwenty_get_theme_svg().
@ -26,9 +28,11 @@ if ( ! function_exists( 'twentytwenty_get_theme_svg' ) ) {
/** /**
* Get information about the SVG icon. * Get information about the SVG icon.
* *
* @since Twenty Twenty 1.0
*
* @param string $svg_name The name of the icon. * @param string $svg_name The name of the icon.
* @param string $group The group the icon belongs to. * @param string $group The group the icon belongs to.
* @param string $color Color code. * @param string $color Color code.
*/ */
function twentytwenty_get_theme_svg( $svg_name, $group = 'ui', $color = '' ) { function twentytwenty_get_theme_svg( $svg_name, $group = 'ui', $color = '' ) {

View File

@ -25,8 +25,10 @@
/** /**
* Displays the site logo, either text or image. * Displays the site logo, either text or image.
* *
* @param array $args Arguments for displaying the site logo either as an image or text. * @since Twenty Twenty 1.0
* @param bool $echo Echo or return the HTML. *
* @param array $args Arguments for displaying the site logo either as an image or text.
* @param bool $echo Echo or return the HTML.
* @return string Compiled HTML based on our arguments. * @return string Compiled HTML based on our arguments.
*/ */
function twentytwenty_site_logo( $args = array(), $echo = true ) { function twentytwenty_site_logo( $args = array(), $echo = true ) {
@ -50,8 +52,10 @@ function twentytwenty_site_logo( $args = array(), $echo = true ) {
/** /**
* Filters the arguments for `twentytwenty_site_logo()`. * Filters the arguments for `twentytwenty_site_logo()`.
* *
* @param array $args Parsed arguments. * @since Twenty Twenty 1.0
* @param array $defaults Function's default arguments. *
* @param array $args Parsed arguments.
* @param array $defaults Function's default arguments.
*/ */
$args = apply_filters( 'twentytwenty_site_logo_args', $args, $defaults ); $args = apply_filters( 'twentytwenty_site_logo_args', $args, $defaults );
@ -70,6 +74,8 @@ function twentytwenty_site_logo( $args = array(), $echo = true ) {
/** /**
* Filters the arguments for `twentytwenty_site_logo()`. * Filters the arguments for `twentytwenty_site_logo()`.
* *
* @since Twenty Twenty 1.0
*
* @param string $html Compiled HTML based on our arguments. * @param string $html Compiled HTML based on our arguments.
* @param array $args Parsed arguments. * @param array $args Parsed arguments.
* @param string $classname Class name based on current view, home or single. * @param string $classname Class name based on current view, home or single.
@ -88,6 +94,8 @@ function twentytwenty_site_logo( $args = array(), $echo = true ) {
/** /**
* Displays the site description. * Displays the site description.
* *
* @since Twenty Twenty 1.0
*
* @param bool $echo Echo or return the html. * @param bool $echo Echo or return the html.
* @return string The HTML to display. * @return string The HTML to display.
*/ */
@ -107,9 +115,9 @@ function twentytwenty_site_description( $echo = true ) {
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @param string $html The HTML to display. * @param string $html The HTML to display.
* @param string $description Site description via `bloginfo()`. * @param string $description Site description via `bloginfo()`.
* @param string $wrapper The format used in case you want to reuse it in a `sprintf()`. * @param string $wrapper The format used in case you want to reuse it in a `sprintf()`.
*/ */
$html = apply_filters( 'twentytwenty_site_description', $html, $description, $wrapper ); $html = apply_filters( 'twentytwenty_site_description', $html, $description, $wrapper );
@ -127,6 +135,8 @@ function twentytwenty_site_description( $echo = true ) {
/** /**
* Checks if the specified comment is written by the author of the post commented on. * Checks if the specified comment is written by the author of the post commented on.
* *
* @since Twenty Twenty 1.0
*
* @param object $comment Comment data. * @param object $comment Comment data.
* @return bool * @return bool
*/ */
@ -153,6 +163,8 @@ function twentytwenty_is_comment_by_post_author( $comment = null ) {
* Filter the comment reply link to add a class indicating it should not use JS slow-scroll, as it * Filter the comment reply link to add a class indicating it should not use JS slow-scroll, as it
* makes it scroll to the wrong position on the page. * makes it scroll to the wrong position on the page.
* *
* @since Twenty Twenty 1.0
*
* @param string $link Link to the top of the page. * @param string $link Link to the top of the page.
* @return string Link to the top of the page. * @return string Link to the top of the page.
*/ */
@ -174,6 +186,8 @@ add_filter( 'comment_reply_link', 'twentytwenty_filter_comment_reply_link' );
* *
* If it's a single post, outputs the post meta values specified in the Customizer settings. * If it's a single post, outputs the post meta values specified in the Customizer settings.
* *
* @since Twenty Twenty 1.0
*
* @param int $post_id The ID of the post for which the post meta should be output. * @param int $post_id The ID of the post for which the post meta should be output.
* @param string $location Which post meta location to output single or preview. * @param string $location Which post meta location to output single or preview.
*/ */
@ -186,6 +200,8 @@ function twentytwenty_the_post_meta( $post_id = null, $location = 'single-top' )
/** /**
* Filters the edit post link to add an icon and use the post meta structure. * Filters the edit post link to add an icon and use the post meta structure.
* *
* @since Twenty Twenty 1.0
*
* @param string $link Anchor tag for the edit link. * @param string $link Anchor tag for the edit link.
* @param int $post_id Post ID. * @param int $post_id Post ID.
* @param string $text Anchor text. * @param string $text Anchor text.
@ -223,7 +239,9 @@ add_filter( 'edit_post_link', 'twentytwenty_edit_post_link', 10, 3 );
/** /**
* Retrieves the post meta. * Retrieves the post meta.
* *
* @param int $post_id The ID of the post. * @since Twenty Twenty 1.0
*
* @param int $post_id The ID of the post.
* @param string $location The location where the meta is shown. * @param string $location The location where the meta is shown.
*/ */
function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' ) { function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' ) {
@ -241,7 +259,7 @@ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' )
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @param array Array of post types * @param array Array of post types.
*/ */
$disallowed_post_types = apply_filters( 'twentytwenty_disallowed_post_types_for_meta_output', array( 'page' ) ); $disallowed_post_types = apply_filters( 'twentytwenty_disallowed_post_types_for_meta_output', array( 'page' ) );
@ -263,10 +281,10 @@ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' )
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @param array $args { * @param array $args {
* @type string 'author' * @type string $author
* @type string 'post-date' * @type string $post-date
* @type string 'comments' * @type string $comments
* @type string 'sticky' * @type string $sticky
* } * }
*/ */
$post_meta = apply_filters( $post_meta = apply_filters(
@ -291,7 +309,7 @@ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' )
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @param array $args { * @param array $args {
* @type string 'tags' * @type string $tags
* } * }
*/ */
$post_meta = apply_filters( $post_meta = apply_filters(
@ -499,6 +517,8 @@ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' )
* Filter the class applied to wp_list_pages() items with children to match the menu class, to simplify. * Filter the class applied to wp_list_pages() items with children to match the menu class, to simplify.
* styling of sub levels in the fallback. Only applied if the match_menu_classes argument is set. * styling of sub levels in the fallback. Only applied if the match_menu_classes argument is set.
* *
* @since Twenty Twenty 1.0
*
* @param string[] $css_class An array of CSS classes to be applied to each list item. * @param string[] $css_class An array of CSS classes to be applied to each list item.
* @param WP_Post $page Page data object. * @param WP_Post $page Page data object.
* @param int $depth Depth of page, used for padding. * @param int $depth Depth of page, used for padding.
@ -534,6 +554,8 @@ add_filter( 'page_css_class', 'twentytwenty_filter_wp_list_pages_item_classes',
/** /**
* Adds a Sub Nav Toggle to the Expanded Menu and Mobile Menu. * Adds a Sub Nav Toggle to the Expanded Menu and Mobile Menu.
* *
* @since Twenty Twenty 1.0
*
* @param stdClass $args An object of wp_nav_menu() arguments. * @param stdClass $args An object of wp_nav_menu() arguments.
* @param WP_Post $item Menu item data object. * @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding. * @param int $depth Depth of menu item. Used for padding.
@ -580,6 +602,8 @@ add_filter( 'nav_menu_item_args', 'twentytwenty_add_sub_toggles_to_main_menu', 1
/** /**
* Displays SVG icons in social links menu. * Displays SVG icons in social links menu.
* *
* @since Twenty Twenty 1.0
*
* @param string $item_output The menu item's starting HTML output. * @param string $item_output The menu item's starting HTML output.
* @param WP_Post $item Menu item data object. * @param WP_Post $item Menu item data object.
* @param int $depth Depth of the menu. Used for padding. * @param int $depth Depth of the menu. Used for padding.
@ -609,6 +633,8 @@ add_filter( 'walker_nav_menu_start_el', 'twentytwenty_nav_menu_social_icons', 10
* Adds 'no-js' class. * Adds 'no-js' class.
* *
* If we're missing JavaScript support, the HTML element will have a 'no-js' class. * If we're missing JavaScript support, the HTML element will have a 'no-js' class.
*
* @since Twenty Twenty 1.0
*/ */
function twentytwenty_no_js_class() { function twentytwenty_no_js_class() {
@ -623,6 +649,8 @@ add_action( 'wp_head', 'twentytwenty_no_js_class' );
/** /**
* Adds conditional body classes. * Adds conditional body classes.
* *
* @since Twenty Twenty 1.0
*
* @param array $classes Classes added to the body tag. * @param array $classes Classes added to the body tag.
* @return array Classes added to the body tag. * @return array Classes added to the body tag.
*/ */
@ -724,11 +752,20 @@ add_filter( 'body_class', 'twentytwenty_body_classes' );
/** /**
* Filters the archive title and styles the word before the first colon. * Filters the archive title and styles the word before the first colon.
* *
* @since Twenty Twenty 1.0
*
* @param string $title Current archive title. * @param string $title Current archive title.
* @return string Current archive title. * @return string Current archive title.
*/ */
function twentytwenty_get_the_archive_title( $title ) { function twentytwenty_get_the_archive_title( $title ) {
/**
* Filters the regular expression used to style the word before the first colon.
*
* @since Twenty Twenty 1.0
*
* @param array $regex An array of regular expression pattern and replacement.
*/
$regex = apply_filters( $regex = apply_filters(
'twentytwenty_get_the_archive_title_regex', 'twentytwenty_get_the_archive_title_regex',
array( array(
@ -756,6 +793,8 @@ add_filter( 'get_the_archive_title', 'twentytwenty_get_the_archive_title' );
/** /**
* Toggles animation duration in milliseconds. * Toggles animation duration in milliseconds.
* *
* @since Twenty Twenty 1.0
*
* @return int Duration in milliseconds * @return int Duration in milliseconds
*/ */
function twentytwenty_toggle_duration() { function twentytwenty_toggle_duration() {
@ -779,6 +818,8 @@ function twentytwenty_toggle_duration() {
* with the optional prefix. As such the returned value is not universally unique, * with the optional prefix. As such the returned value is not universally unique,
* but it is unique across the life of the PHP process. * but it is unique across the life of the PHP process.
* *
* @since Twenty Twenty 1.0
*
* @see wp_unique_id() Themes requiring WordPress 5.0.3 and greater should use this instead. * @see wp_unique_id() Themes requiring WordPress 5.0.3 and greater should use this instead.
* *
* @param string $prefix Prefix for the returned ID. * @param string $prefix Prefix for the returned ID.

View File

@ -59,7 +59,7 @@
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @param bool Whether to show the categories in article header, Default true. * @param bool Whether to show the categories in article header. Default true.
*/ */
$show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true ); $show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true );
@ -162,10 +162,10 @@
get_template_part( 'template-parts/navigation' ); get_template_part( 'template-parts/navigation' );
} }
/** /*
* Output comments wrapper if it's a post, or if comments are open, * Output comments wrapper if it's a post, or if comments are open,
* or if there's a comment number and check for password. * or if there's a comment number and check for password.
* */ */
if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) { if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) {
?> ?>

View File

@ -74,10 +74,10 @@
} }
/** /*
* Output comments wrapper if it's a post, or if comments are open, * Output comments wrapper if it's a post, or if comments are open,
* or if there's a comment number and check for password. * or if there's a comment number and check for password.
* */ */
if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) { if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) {
?> ?>

View File

@ -25,7 +25,7 @@ if ( is_singular() ) {
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @param bool Whether to show the categories in header, Default true. * @param bool Whether to show the categories in header. Default true.
*/ */
$show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true ); $show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true );

View File

@ -9,19 +9,21 @@
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
*/ */
/**
* Translators:
* This text contains HTML to allow the text to be shorter on small screens.
* The text inside the span with the class nav-short will be hidden on small screens.
*/
$prev_text = sprintf( $prev_text = sprintf(
'%s <span class="nav-prev-text">%s</span>', '%s <span class="nav-prev-text">%s</span>',
'<span aria-hidden="true">&larr;</span>', '<span aria-hidden="true">&larr;</span>',
/*
* Translators: This text contains HTML to allow the text to be shorter on small screens.
* The text inside the span with the class nav-short will be hidden on small screens.
*/
__( 'Newer <span class="nav-short">Posts</span>', 'twentytwenty' ) __( 'Newer <span class="nav-short">Posts</span>', 'twentytwenty' )
); );
$next_text = sprintf( $next_text = sprintf(
'<span class="nav-next-text">%s</span> %s', '<span class="nav-next-text">%s</span> %s',
/*
* Translators: This text contains HTML to allow the text to be shorter on small screens.
* The text inside the span with the class nav-short will be hidden on small screens.
*/
__( 'Older <span class="nav-short">Posts</span>', 'twentytwenty' ), __( 'Older <span class="nav-short">Posts</span>', 'twentytwenty' ),
'<span aria-hidden="true">&rarr;</span>' '<span aria-hidden="true">&rarr;</span>'
); );

View File

@ -507,7 +507,8 @@ function twenty_twenty_one_skip_link_focus_fix() {
} }
add_action( 'wp_print_footer_scripts', 'twenty_twenty_one_skip_link_focus_fix' ); add_action( 'wp_print_footer_scripts', 'twenty_twenty_one_skip_link_focus_fix' );
/** Enqueue non-latin language styles /**
* Enqueue non-latin language styles.
* *
* @since Twenty Twenty-One 1.0 * @since Twenty Twenty-One 1.0
* *

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-alpha-51321'; $wp_version = '5.9-alpha-51322';
/** /**
* 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.