[ 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  
  13  if ( ! 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  
  31  endif;
  32  
  33  add_action( 'after_setup_theme', 'twentytwentytwo_support' );
  34  
  35  if ( ! 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  
  60  endif;
  61  
  62  add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' );
  63  
  64  // Add block patterns
  65  require get_template_directory() . '/inc/block-patterns.php';


Generated : Tue Apr 23 08:20:01 2024 Cross-referenced by PHPXref