首页 WordPress函数大全 add_theme_support()

add_theme_support()

2020-05-01 / 4109阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

add_theme_support( string $feature, mixed $args )

Registers theme support for a given feature.

描述

Must be called in the theme’s functions.php file to work. If attached to a hook, it must be ‘after_setup_theme’. The ‘init’ hook may be too late for some features.

Example usage:

add_theme_support( 'title-tag' );
add_theme_support( 'custom-logo', array(
    'height' => 480,
    'width'  => 720,
) ); 

参数

$feature

(string)
(Required)
The feature being added. Likely core values include 'post-formats', 'post-thumbnails', 'html5', 'custom-logo', 'custom-header-uploads', 'custom-header', 'custom-background', 'title-tag', 'starter-content', 'responsive-embeds', etc.

$args

(mixed)
(Optional)
extra arguments to pass along with certain features.

返回

(void|bool) False on failure, void otherwise.

大家谈论
    我的见解