[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentytwentytwo/ -> functions.php (source)

   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  if ( ! function_exists( 'twentytwentytwo_support' ) ) :
  13  
  14      /**
  15       * Sets up theme defaults and registers support for various WordPress features.
  16       *
  17       * @since Twenty Twenty-Two 1.0
  18       *
  19       * @return void
  20       */
  21  	function twentytwentytwo_support() {
  22  
  23          // Add support for block styles.
  24          add_theme_support( 'wp-block-styles' );
  25  
  26          // Enqueue editor styles.
  27          add_editor_style( 'style.css' );
  28      }
  29  
  30  endif;
  31  
  32  add_action( 'after_setup_theme', 'twentytwentytwo_support' );
  33  
  34  if ( ! function_exists( 'twentytwentytwo_styles' ) ) :
  35  
  36      /**
  37       * Enqueues styles.
  38       *
  39       * @since Twenty Twenty-Two 1.0
  40       *
  41       * @return void
  42       */
  43  	function twentytwentytwo_styles() {
  44          // Register theme stylesheet.
  45          $theme_version = wp_get_theme()->get( 'Version' );
  46  
  47          $version_string = is_string( $theme_version ) ? $theme_version : false;
  48  
  49          $suffix = SCRIPT_DEBUG ? '' : '.min';
  50          $src    = 'style' . $suffix . '.css';
  51  
  52          wp_enqueue_style(
  53              'twentytwentytwo-style',
  54              get_parent_theme_file_uri( $src ),
  55              array(),
  56              $version_string
  57          );
  58          wp_style_add_data(
  59              'twentytwentytwo-style',
  60              'path',
  61              get_parent_theme_file_path( $src )
  62          );
  63      }
  64  
  65  endif;
  66  
  67  add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' );
  68  
  69  // Add block patterns.
  70  require get_template_directory() . '/inc/block-patterns.php';


Generated : Mon May 25 08:20:05 2026 Cross-referenced by PHPXref