get_theme_support()获取一个主题或者插件支持的功能

目录

描述

Allows a theme or plugin to get support of a certain theme feature.

get_theme_support() 描述

用法

<?php get_theme_support$feature ); ?>

get_theme_support() 用法

参数

$feature

(string) (必填) Name for the feature being added.

默认值: None

Features list:

  • Sidebar Widgets
  • Navigation Menus
  • Post Formats
  • Post Thumbnails
  • Custom Backgrounds
  • Custom Headers
  • Automatic Feed Links
  • Editor Style

See Theme Features for more information.

get_theme_support() 参数

源文件

get_theme_support() 函数的代码位于 wp-includes/theme.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Gets the theme support arguments passed when registering that support
 *
 * @since 3.1.0
 *
 * @global array $_wp_theme_features
 *
 * @param string $feature the feature to check
 * @return mixed The array of extra arguments or the value for the registered feature.
 */
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-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="" ];="" }="" }="">

get_theme_support() 源文件

相关