[ Index ]

PHP Cross Reference of WordPress

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  
  32  endif;
  33  
  34  add_action( 'after_setup_theme', 'twentytwentytwo_support' );
  35  
  36  if ( ! function_exists( 'twentytwentytwo_styles' ) ) :
  37  
  38      /**
  39       * Enqueue styles.
  40       *
  41       * @since Twenty Twenty-Two 1.0
  42       *
  43       * @return void
  44       */
  45  	function twentytwentytwo_styles() {
  46          // Register theme stylesheet.
  47          $theme_version = wp_get_theme()->get( 'Version' );
  48  
  49          $version_string = is_string( $theme_version ) ? $theme_version : false;
  50          wp_register_style(
  51              'twentytwentytwo-style',
  52              get_template_directory_uri() . '/style.css',
  53              array(),
  54              $version_string
  55          );
  56  
  57          // Enqueue theme stylesheet.
  58          wp_enqueue_style( 'twentytwentytwo-style' );
  59  
  60      }
  61  
  62  endif;
  63  
  64  add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' );
  65  
  66  // Add block patterns
  67  require get_template_directory() . '/inc/block-patterns.php';


Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1