get_theme_support()

最后更新于:2021-11-27 01:01:15

get_theme_support( string$feature, mixed$args)

Gets the theme support arguments passed when registering that support.

参数

$feature

(string) (Required) The feature to check. See add_theme_support() for the list of possible values.

$args

(mixed) (Optional) extra arguments to be checked against certain features.

响应

(mixed) The array of extra arguments or the value for the registered feature.

源文件

文件: gc-includes/theme.php

function get_theme_support( $feature, ...$args ) {
	global $_gc_theme_features;
	if ( ! isset( $_gc_theme_features[ $feature ] ) ) {
		return false;
	}

	if ( ! $args ) {
		return $_gc_theme_features[ $feature ];
	}

	switch ( $feature ) {
		case 'custom-logo':
		case 'custom-header':
		case 'custom-background':
			if ( isset( $_gc_theme_features[ $feature ][0][ $args[0] ] ) ) {
				return $_gc_theme_features[ $feature ][0][ $args[0] ];
			}
			return false;

		default:
			return $_gc_theme_features[ $feature ];
	}
}
Array
(
    [0] => Array
        (
            [default-image] =>
            [default-repeat] => repeat
            [default-position-x] => left
            [default-attachment] => scroll
            [default-color] => ffffff
            [gc-head-callback] => _custom_background_cb
            [admin-head-callback] =>
            [admin-preview-callback] =>
        )

)