mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-09 04:11:10 +01:00
dac4e3be11
This commit adds three style variations to Twenty Twenty-Two, allowing users to quickly swap between different visual styles — "Blue", "Pink", and "Swiss" — for the default theme. The variations are previewed and selected from the Site Editor's global styles panel. For the implementation, each variation is defined by its own theme.json file within the "/styles" directory of the theme. All variations leverage the internal-only theme.json handler of the Webfonts API [53282] to load locally hosted fonts. Props kjellr, hellofromtonya. See #55433. Built from https://develop.svn.wordpress.org/trunk@53286 git-svn-id: http://core.svn.wordpress.org/trunk@52875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
68 lines
1.4 KiB
PHP
68 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* Twenty Twenty-Two functions and definitions
|
|
*
|
|
* @link https://developer.wordpress.org/themes/basics/theme-functions/
|
|
*
|
|
* @package WordPress
|
|
* @subpackage Twenty_Twenty_Two
|
|
* @since Twenty Twenty-Two 1.0
|
|
*/
|
|
|
|
|
|
if ( ! function_exists( 'twentytwentytwo_support' ) ) :
|
|
|
|
/**
|
|
* Sets up theme defaults and registers support for various WordPress features.
|
|
*
|
|
* @since Twenty Twenty-Two 1.0
|
|
*
|
|
* @return void
|
|
*/
|
|
function twentytwentytwo_support() {
|
|
|
|
// Add support for block styles.
|
|
add_theme_support( 'wp-block-styles' );
|
|
|
|
// Enqueue editor styles.
|
|
add_editor_style( 'style.css' );
|
|
|
|
}
|
|
|
|
endif;
|
|
|
|
add_action( 'after_setup_theme', 'twentytwentytwo_support' );
|
|
|
|
if ( ! function_exists( 'twentytwentytwo_styles' ) ) :
|
|
|
|
/**
|
|
* Enqueue styles.
|
|
*
|
|
* @since Twenty Twenty-Two 1.0
|
|
*
|
|
* @return void
|
|
*/
|
|
function twentytwentytwo_styles() {
|
|
// Register theme stylesheet.
|
|
$theme_version = wp_get_theme()->get( 'Version' );
|
|
|
|
$version_string = is_string( $theme_version ) ? $theme_version : false;
|
|
wp_register_style(
|
|
'twentytwentytwo-style',
|
|
get_template_directory_uri() . '/style.css',
|
|
array(),
|
|
$version_string
|
|
);
|
|
|
|
// Enqueue theme stylesheet.
|
|
wp_enqueue_style( 'twentytwentytwo-style' );
|
|
|
|
}
|
|
|
|
endif;
|
|
|
|
add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' );
|
|
|
|
// Add block patterns
|
|
require get_template_directory() . '/inc/block-patterns.php';
|