get_theme_support() - WordPress 函数参考中文文档

返回介绍

get_theme_support()

发布于 2017-09-11 字数5288 浏览 908 评论 0

get_theme_support( string $feature )

Gets the theme support arguments passed when registering that support


描述


参数

$feature

(string)
(Required)
the feature to check


返回值

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


源代码

File: wp-includes/theme.php

function get_theme_support( $feature ) {
	global $_wp_theme_features;
	if ( ! isset( $_wp_theme_features[ $feature ] ) )
		return false;

	if ( func_num_args() <= 1 )
		return $_wp_theme_features[ $feature ];

	$args = array_slice( func_get_args(), 1 );
	switch ( $feature ) {
		case 'custom-logo' :
		case 'custom-header' :
		case 'custom-background' :
			if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) )
				return $_wp_theme_features[ $feature ][0][ $args[0] ];
			return false;

		default :
			return $_wp_theme_features[ $feature ];
	}
}

更新日志

Version 描述
3.1.0 Introduced.

相关函数

Used By

  • wp-includes/theme.php:
    get_theme_starter_content()
  • wp-includes/theme.php:
    is_header_video_active()
  • wp-includes/theme.php:
    _custom_logo_header_styles()
  • wp-admin/includes/class-wp-press-this.php:
    WP_Press_This::post_formats_html()
  • wp-includes/customize/class-wp-customize-background-image-control.php:
    WP_Customize_Background_Image_Control::enqueue()
  • wp-admin/includes/meta-boxes.php:
    post_format_meta_box()
  • wp-admin/includes/class-wp-posts-list-table.php:
    WP_Posts_List_Table::inline_edit()
  • wp-admin/custom-header.php:
    Custom_Image_Header::get_header_dimensions()
  • wp-admin/custom-header.php:
    Custom_Image_Header::get_default_header_images()
  • wp-admin/custom-header.php:
    Custom_Image_Header::step_1()
  • wp-admin/custom-header.php:
    Custom_Image_Header::step_2()
  • wp-admin/custom-header.php:
    Custom_Image_Header::reset_header_image()
  • wp-admin/custom-header.php:
    Custom_Image_Header::js_1()
  • wp-admin/custom-header.php:
    Custom_Image_Header::js_2()
  • wp-admin/custom-background.php:
    Custom_Background::admin_page()
  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::register_controls()
  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::_sanitize_header_textcolor()
  • wp-includes/theme.php:
    get_background_color()
  • wp-includes/theme.php:
    _custom_background_cb()
  • wp-includes/theme.php:
    add_theme_support()
  • wp-includes/theme.php:
    _custom_header_background_just_in_time()
  • wp-includes/theme.php:
    _remove_theme_support()
  • wp-includes/theme.php:
    get_header_textcolor()
  • wp-includes/theme.php:
    display_header_text()
  • wp-includes/theme.php:
    get_header_image()
  • wp-includes/theme.php:
    is_random_header_image()
  • wp-includes/theme.php:
    get_custom_header()
  • wp-includes/theme.php:
    get_background_image()
  • wp-includes/class-wp-admin-bar.php:
    WP_Admin_Bar::initialize()
  • wp-includes/customize/class-wp-customize-header-image-setting.php:
    WP_Customize_Header_Image_Setting::update()
  • wp-includes/post-template.php:
    get_body_class()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getPostFormats()
  • wp-includes/customize/class-wp-customize-header-image-control.php:
    WP_Customize_Header_Image_Control::enqueue()
  • wp-includes/customize/class-wp-customize-header-image-control.php:
    WP_Customize_Header_Image_Control::render_content()
  • Show 29 more used by
    Hide more used by


User Contributed Notes

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 1You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Gets the `custom-background` theme support arguments

    
    $theme_support = get_theme_support( 'custom-background' );
    

    Output:

    
    Array
    (
        [0] => Array
            (
                [default-image] =>
                [default-repeat] => repeat
                [default-position-x] => left
                [default-attachment] => scroll
                [default-color] => ffffff
                [wp-head-callback] => _custom_background_cb
                [admin-head-callback] =>
                [admin-preview-callback] =>
            )
    
    )

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!