第一步,定义函数:
function twentytwenty_theme_support()
第二步,增加钩子:
add_action( ‘after_setup_theme’, ‘twentytwenty_theme_support’ );
在twentytwenty_theme_support里:
包括
- add_theme_support
// Add default posts and comments RSS feed links to head.
add_theme_support( ‘automatic-feed-links’ );
// Custom background color.
add_theme_support(
‘custom-background’,
array(
‘default-color’ => ‘f5efe0’,
)
);
// Set content-width.
global $content_width;
if ( ! isset( $content_width ) ) {
$content_width = 580;
}
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( ‘post-thumbnails’ );
// Set post thumbnail size.
set_post_thumbnail_size( 1200, 9999 );
// Add custom image size used in Cover Template.
add_image_size( ‘twentytwenty-fullscreen’, 1980, 9999 );
// Custom logo.
$logo_width = 120;
$logo_height = 90;
// If the retina setting is active, double the recommended width and height.
if ( get_theme_mod( ‘retina_logo’, false ) ) {
$logo_width = floor( $logo_width * 2 );
$logo_height = floor( $logo_height * 2 );
}
add_theme_support(
‘custom-logo’,
array(
‘height’ => $logo_height,
‘width’ => $logo_width,
‘flex-height’ => true,
‘flex-width’ => true,
)
);
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded