Make WordPress Themes

source: twentytwentytwo/1.9/functions.php

Last change on this file was 207578, checked in by themedropbox, 2 years ago

New version of Twenty Twenty-Two - 1.6

File size: 1.4 KB
Line 
1<?php
2/**
3 * Twenty Twenty-Two functions and definitions
4 *
5 * @link https://developer.wordpress.org/themes/basics/theme-functions/
6 *
7 * @package WordPress
8 * @subpackage Twenty_Twenty_Two
9 * @since Twenty Twenty-Two 1.0
10 */
11
12
13if ( ! function_exists( 'twentytwentytwo_support' ) ) :
14
15        /**
16         * Sets up theme defaults and registers support for various WordPress features.
17         *
18         * @since Twenty Twenty-Two 1.0
19         *
20         * @return void
21         */
22        function twentytwentytwo_support() {
23
24                // Add support for block styles.
25                add_theme_support( 'wp-block-styles' );
26
27                // Enqueue editor styles.
28                add_editor_style( 'style.css' );
29        }
30
31endif;
32
33add_action( 'after_setup_theme', 'twentytwentytwo_support' );
34
35if ( ! function_exists( 'twentytwentytwo_styles' ) ) :
36
37        /**
38         * Enqueue styles.
39         *
40         * @since Twenty Twenty-Two 1.0
41         *
42         * @return void
43         */
44        function twentytwentytwo_styles() {
45                // Register theme stylesheet.
46                $theme_version = wp_get_theme()->get( 'Version' );
47
48                $version_string = is_string( $theme_version ) ? $theme_version : false;
49                wp_register_style(
50                        'twentytwentytwo-style',
51                        get_template_directory_uri() . '/style.css',
52                        array(),
53                        $version_string
54                );
55
56                // Enqueue theme stylesheet.
57                wp_enqueue_style( 'twentytwentytwo-style' );
58        }
59
60endif;
61
62add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' );
63
64// Add block patterns
65require get_template_directory() . '/inc/block-patterns.php';
Note: See TracBrowser for help on using the repository browser.