Docs: Improve documentation for get_theme_mod()
and set_theme_mod()
.
See #47110. git-svn-id: https://develop.svn.wordpress.org/trunk@46394 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c411aad31b
commit
1be6c41ada
@ -905,15 +905,15 @@ function get_theme_mods() {
|
|||||||
* Retrieve theme modification value for the current theme.
|
* Retrieve theme modification value for the current theme.
|
||||||
*
|
*
|
||||||
* If the modification name does not exist, then the $default will be passed
|
* If the modification name does not exist, then the $default will be passed
|
||||||
* through {@link https://secure.php.net/sprintf sprintf()} PHP function with the first
|
* through {@link https://secure.php.net/sprintf sprintf()} PHP function with
|
||||||
* string the template directory URI and the second string the stylesheet
|
* the template directory URI as the first string and the stylesheet directory URI
|
||||||
* directory URI.
|
* as the second string.
|
||||||
*
|
*
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*
|
*
|
||||||
* @param string $name Theme modification name.
|
* @param string $name Theme modification name.
|
||||||
* @param bool|string $default
|
* @param string|false $default Optional. Theme modification default value. Default false.
|
||||||
* @return mixed
|
* @return mixed Theme modification value.
|
||||||
*/
|
*/
|
||||||
function get_theme_mod( $name, $default = false ) {
|
function get_theme_mod( $name, $default = false ) {
|
||||||
$mods = get_theme_mods();
|
$mods = get_theme_mods();
|
||||||
@ -922,10 +922,9 @@ function get_theme_mod( $name, $default = false ) {
|
|||||||
/**
|
/**
|
||||||
* Filters the theme modification, or 'theme_mod', value.
|
* Filters the theme modification, or 'theme_mod', value.
|
||||||
*
|
*
|
||||||
* The dynamic portion of the hook name, `$name`, refers to
|
* The dynamic portion of the hook name, `$name`, refers to the key name
|
||||||
* the key name of the modification array. For example,
|
* of the modification array. For example, 'header_textcolor', 'header_image',
|
||||||
* 'header_textcolor', 'header_image', and so on depending
|
* and so on depending on the theme options.
|
||||||
* on the theme options.
|
|
||||||
*
|
*
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
*
|
*
|
||||||
@ -955,16 +954,16 @@ function set_theme_mod( $name, $value ) {
|
|||||||
$old_value = isset( $mods[ $name ] ) ? $mods[ $name ] : false;
|
$old_value = isset( $mods[ $name ] ) ? $mods[ $name ] : false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the theme mod value on save.
|
* Filters the theme modification, or 'theme_mod', value on save.
|
||||||
*
|
*
|
||||||
* The dynamic portion of the hook name, `$name`, refers to the key name of
|
* The dynamic portion of the hook name, `$name`, refers to the key name
|
||||||
* the modification array. For example, 'header_textcolor', 'header_image',
|
* of the modification array. For example, 'header_textcolor', 'header_image',
|
||||||
* and so on depending on the theme options.
|
* and so on depending on the theme options.
|
||||||
*
|
*
|
||||||
* @since 3.9.0
|
* @since 3.9.0
|
||||||
*
|
*
|
||||||
* @param string $value The new value of the theme mod.
|
* @param string $value The new value of the theme modification.
|
||||||
* @param string $old_value The current value of the theme mod.
|
* @param string $old_value The current value of the theme modification.
|
||||||
*/
|
*/
|
||||||
$mods[ $name ] = apply_filters( "pre_set_theme_mod_{$name}", $value, $old_value );
|
$mods[ $name ] = apply_filters( "pre_set_theme_mod_{$name}", $value, $old_value );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user