[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Functions and definitions
   4   *
   5   * @link https://developer.wordpress.org/themes/basics/theme-functions/
   6   *
   7   * @package WordPress
   8   * @subpackage Twenty_Twenty_One
   9   * @since Twenty Twenty-One 1.0
  10   */
  11  
  12  // This theme requires WordPress 5.3 or later.
  13  if ( version_compare( $GLOBALS['wp_version'], '5.3', '<' ) ) {
  14      require get_template_directory() . '/inc/back-compat.php';
  15  }
  16  
  17  if ( ! function_exists( 'twenty_twenty_one_setup' ) ) {
  18      /**
  19       * Sets up theme defaults and registers support for various WordPress features.
  20       *
  21       * Note that this function is hooked into the after_setup_theme hook, which
  22       * runs before the init hook. The init hook is too late for some features, such
  23       * as indicating support for post thumbnails.
  24       *
  25       * @since Twenty Twenty-One 1.0
  26       *
  27       * @return void
  28       */
  29  	function twenty_twenty_one_setup() {
  30  
  31          // Add default posts and comments RSS feed links to head.
  32          add_theme_support( 'automatic-feed-links' );
  33  
  34          /*
  35           * Let WordPress manage the document title.
  36           * This theme does not use a hard-coded <title> tag in the document head,
  37           * WordPress will provide it for us.
  38           */
  39          add_theme_support( 'title-tag' );
  40  
  41          /**
  42           * Add post-formats support.
  43           */
  44          add_theme_support(
  45              'post-formats',
  46              array(
  47                  'link',
  48                  'aside',
  49                  'gallery',
  50                  'image',
  51                  'quote',
  52                  'status',
  53                  'video',
  54                  'audio',
  55                  'chat',
  56              )
  57          );
  58  
  59          /*
  60           * Enable support for Post Thumbnails on posts and pages.
  61           *
  62           * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
  63           */
  64          add_theme_support( 'post-thumbnails' );
  65          set_post_thumbnail_size( 1568, 9999 );
  66  
  67          register_nav_menus(
  68              array(
  69                  'primary' => esc_html__( 'Primary menu', 'twentytwentyone' ),
  70                  'footer'  => esc_html__( 'Secondary menu', 'twentytwentyone' ),
  71              )
  72          );
  73  
  74          /*
  75           * Switch default core markup for search form, comment form, and comments
  76           * to output valid HTML5.
  77           */
  78          add_theme_support(
  79              'html5',
  80              array(
  81                  'comment-form',
  82                  'comment-list',
  83                  'gallery',
  84                  'caption',
  85                  'style',
  86                  'script',
  87                  'navigation-widgets',
  88              )
  89          );
  90  
  91          /*
  92           * Add support for core custom logo.
  93           *
  94           * @link https://codex.wordpress.org/Theme_Logo
  95           */
  96          $logo_width  = 300;
  97          $logo_height = 100;
  98  
  99          add_theme_support(
 100              'custom-logo',
 101              array(
 102                  'height'               => $logo_height,
 103                  'width'                => $logo_width,
 104                  'flex-width'           => true,
 105                  'flex-height'          => true,
 106                  'unlink-homepage-logo' => true,
 107              )
 108          );
 109  
 110          // Add theme support for selective refresh for widgets.
 111          add_theme_support( 'customize-selective-refresh-widgets' );
 112  
 113          // Add support for Block Styles.
 114          add_theme_support( 'wp-block-styles' );
 115  
 116          // Add support for full and wide align images.
 117          add_theme_support( 'align-wide' );
 118  
 119          // Add support for editor styles.
 120          add_theme_support( 'editor-styles' );
 121          $background_color = get_theme_mod( 'background_color', 'D1E4DD' );
 122          if ( 127 > Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) ) {
 123              add_theme_support( 'dark-editor-style' );
 124          }
 125  
 126          $editor_stylesheet_path = './assets/css/style-editor.css';
 127  
 128          // Note, the is_IE global variable is defined by WordPress and is used
 129          // to detect if the current browser is internet explorer.
 130          global $is_IE;
 131          if ( $is_IE ) {
 132              $editor_stylesheet_path = './assets/css/ie-editor.css';
 133          }
 134  
 135          // Enqueue editor styles.
 136          add_editor_style( $editor_stylesheet_path );
 137  
 138          // Add custom editor font sizes.
 139          add_theme_support(
 140              'editor-font-sizes',
 141              array(
 142                  array(
 143                      'name'      => esc_html__( 'Extra small', 'twentytwentyone' ),
 144                      'shortName' => esc_html_x( 'XS', 'Font size', 'twentytwentyone' ),
 145                      'size'      => 16,
 146                      'slug'      => 'extra-small',
 147                  ),
 148                  array(
 149                      'name'      => esc_html__( 'Small', 'twentytwentyone' ),
 150                      'shortName' => esc_html_x( 'S', 'Font size', 'twentytwentyone' ),
 151                      'size'      => 18,
 152                      'slug'      => 'small',
 153                  ),
 154                  array(
 155                      'name'      => esc_html__( 'Normal', 'twentytwentyone' ),
 156                      'shortName' => esc_html_x( 'M', 'Font size', 'twentytwentyone' ),
 157                      'size'      => 20,
 158                      'slug'      => 'normal',
 159                  ),
 160                  array(
 161                      'name'      => esc_html__( 'Large', 'twentytwentyone' ),
 162                      'shortName' => esc_html_x( 'L', 'Font size', 'twentytwentyone' ),
 163                      'size'      => 24,
 164                      'slug'      => 'large',
 165                  ),
 166                  array(
 167                      'name'      => esc_html__( 'Extra large', 'twentytwentyone' ),
 168                      'shortName' => esc_html_x( 'XL', 'Font size', 'twentytwentyone' ),
 169                      'size'      => 40,
 170                      'slug'      => 'extra-large',
 171                  ),
 172                  array(
 173                      'name'      => esc_html__( 'Huge', 'twentytwentyone' ),
 174                      'shortName' => esc_html_x( 'XXL', 'Font size', 'twentytwentyone' ),
 175                      'size'      => 96,
 176                      'slug'      => 'huge',
 177                  ),
 178                  array(
 179                      'name'      => esc_html__( 'Gigantic', 'twentytwentyone' ),
 180                      'shortName' => esc_html_x( 'XXXL', 'Font size', 'twentytwentyone' ),
 181                      'size'      => 144,
 182                      'slug'      => 'gigantic',
 183                  ),
 184              )
 185          );
 186  
 187          // Custom background color.
 188          add_theme_support(
 189              'custom-background',
 190              array(
 191                  'default-color' => 'd1e4dd',
 192              )
 193          );
 194  
 195          // Editor color palette.
 196          $black     = '#000000';
 197          $dark_gray = '#28303D';
 198          $gray      = '#39414D';
 199          $green     = '#D1E4DD';
 200          $blue      = '#D1DFE4';
 201          $purple    = '#D1D1E4';
 202          $red       = '#E4D1D1';
 203          $orange    = '#E4DAD1';
 204          $yellow    = '#EEEADD';
 205          $white     = '#FFFFFF';
 206  
 207          add_theme_support(
 208              'editor-color-palette',
 209              array(
 210                  array(
 211                      'name'  => esc_html__( 'Black', 'twentytwentyone' ),
 212                      'slug'  => 'black',
 213                      'color' => $black,
 214                  ),
 215                  array(
 216                      'name'  => esc_html__( 'Dark gray', 'twentytwentyone' ),
 217                      'slug'  => 'dark-gray',
 218                      'color' => $dark_gray,
 219                  ),
 220                  array(
 221                      'name'  => esc_html__( 'Gray', 'twentytwentyone' ),
 222                      'slug'  => 'gray',
 223                      'color' => $gray,
 224                  ),
 225                  array(
 226                      'name'  => esc_html__( 'Green', 'twentytwentyone' ),
 227                      'slug'  => 'green',
 228                      'color' => $green,
 229                  ),
 230                  array(
 231                      'name'  => esc_html__( 'Blue', 'twentytwentyone' ),
 232                      'slug'  => 'blue',
 233                      'color' => $blue,
 234                  ),
 235                  array(
 236                      'name'  => esc_html__( 'Purple', 'twentytwentyone' ),
 237                      'slug'  => 'purple',
 238                      'color' => $purple,
 239                  ),
 240                  array(
 241                      'name'  => esc_html__( 'Red', 'twentytwentyone' ),
 242                      'slug'  => 'red',
 243                      'color' => $red,
 244                  ),
 245                  array(
 246                      'name'  => esc_html__( 'Orange', 'twentytwentyone' ),
 247                      'slug'  => 'orange',
 248                      'color' => $orange,
 249                  ),
 250                  array(
 251                      'name'  => esc_html__( 'Yellow', 'twentytwentyone' ),
 252                      'slug'  => 'yellow',
 253                      'color' => $yellow,
 254                  ),
 255                  array(
 256                      'name'  => esc_html__( 'White', 'twentytwentyone' ),
 257                      'slug'  => 'white',
 258                      'color' => $white,
 259                  ),
 260              )
 261          );
 262  
 263          add_theme_support(
 264              'editor-gradient-presets',
 265              array(
 266                  array(
 267                      'name'     => esc_html__( 'Purple to yellow', 'twentytwentyone' ),
 268                      'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $yellow . ' 100%)',
 269                      'slug'     => 'purple-to-yellow',
 270                  ),
 271                  array(
 272                      'name'     => esc_html__( 'Yellow to purple', 'twentytwentyone' ),
 273                      'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $purple . ' 100%)',
 274                      'slug'     => 'yellow-to-purple',
 275                  ),
 276                  array(
 277                      'name'     => esc_html__( 'Green to yellow', 'twentytwentyone' ),
 278                      'gradient' => 'linear-gradient(160deg, ' . $green . ' 0%, ' . $yellow . ' 100%)',
 279                      'slug'     => 'green-to-yellow',
 280                  ),
 281                  array(
 282                      'name'     => esc_html__( 'Yellow to green', 'twentytwentyone' ),
 283                      'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $green . ' 100%)',
 284                      'slug'     => 'yellow-to-green',
 285                  ),
 286                  array(
 287                      'name'     => esc_html__( 'Red to yellow', 'twentytwentyone' ),
 288                      'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $yellow . ' 100%)',
 289                      'slug'     => 'red-to-yellow',
 290                  ),
 291                  array(
 292                      'name'     => esc_html__( 'Yellow to red', 'twentytwentyone' ),
 293                      'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $red . ' 100%)',
 294                      'slug'     => 'yellow-to-red',
 295                  ),
 296                  array(
 297                      'name'     => esc_html__( 'Purple to red', 'twentytwentyone' ),
 298                      'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $red . ' 100%)',
 299                      'slug'     => 'purple-to-red',
 300                  ),
 301                  array(
 302                      'name'     => esc_html__( 'Red to purple', 'twentytwentyone' ),
 303                      'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $purple . ' 100%)',
 304                      'slug'     => 'red-to-purple',
 305                  ),
 306              )
 307          );
 308  
 309          /*
 310          * Adds starter content to highlight the theme on fresh sites.
 311          * This is done conditionally to avoid loading the starter content on every
 312          * page load, as it is a one-off operation only needed once in the customizer.
 313          */
 314          if ( is_customize_preview() ) {
 315              require get_template_directory() . '/inc/starter-content.php';
 316              add_theme_support( 'starter-content', twenty_twenty_one_get_starter_content() );
 317          }
 318  
 319          // Add support for responsive embedded content.
 320          add_theme_support( 'responsive-embeds' );
 321  
 322          // Add support for custom line height controls.
 323          add_theme_support( 'custom-line-height' );
 324  
 325          // Add support for link color control.
 326          add_theme_support( 'link-color' );
 327  
 328          // Add support for experimental cover block spacing.
 329          add_theme_support( 'custom-spacing' );
 330  
 331          // Add support for custom units.
 332          // This was removed in WordPress 5.6 but is still required to properly support WP 5.5.
 333          add_theme_support( 'custom-units' );
 334  
 335          // Remove feed icon link from legacy RSS widget.
 336          add_filter( 'rss_widget_feed_link', '__return_empty_string' );
 337      }
 338  }
 339  add_action( 'after_setup_theme', 'twenty_twenty_one_setup' );
 340  
 341  /**
 342   * Registers widget area.
 343   *
 344   * @since Twenty Twenty-One 1.0
 345   *
 346   * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 347   *
 348   * @return void
 349   */
 350  function twenty_twenty_one_widgets_init() {
 351  
 352      register_sidebar(
 353          array(
 354              'name'          => esc_html__( 'Footer', 'twentytwentyone' ),
 355              'id'            => 'sidebar-1',
 356              'description'   => esc_html__( 'Add widgets here to appear in your footer.', 'twentytwentyone' ),
 357              'before_widget' => '<section id="%1$s" class="widget %2$s">',
 358              'after_widget'  => '</section>',
 359              'before_title'  => '<h2 class="widget-title">',
 360              'after_title'   => '</h2>',
 361          )
 362      );
 363  }
 364  add_action( 'widgets_init', 'twenty_twenty_one_widgets_init' );
 365  
 366  /**
 367   * Sets the content width in pixels, based on the theme's design and stylesheet.
 368   *
 369   * Priority 0 to make it available to lower priority callbacks.
 370   *
 371   * @since Twenty Twenty-One 1.0
 372   *
 373   * @global int $content_width Content width.
 374   *
 375   * @return void
 376   */
 377  function twenty_twenty_one_content_width() {
 378      // This variable is intended to be overruled from themes.
 379      // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
 380      // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
 381      $GLOBALS['content_width'] = apply_filters( 'twenty_twenty_one_content_width', 750 );
 382  }
 383  add_action( 'after_setup_theme', 'twenty_twenty_one_content_width', 0 );
 384  
 385  /**
 386   * Enqueues scripts and styles.
 387   *
 388   * @since Twenty Twenty-One 1.0
 389   *
 390   * @global bool       $is_IE
 391   * @global WP_Scripts $wp_scripts
 392   *
 393   * @return void
 394   */
 395  function twenty_twenty_one_scripts() {
 396      // Note, the is_IE global variable is defined by WordPress and is used
 397      // to detect if the current browser is internet explorer.
 398      global $is_IE, $wp_scripts;
 399      if ( $is_IE ) {
 400          // If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables.
 401          wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get( 'Version' ) );
 402      } else {
 403          // If not IE, use the standard stylesheet.
 404          wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
 405      }
 406  
 407      // RTL styles.
 408      wp_style_add_data( 'twenty-twenty-one-style', 'rtl', 'replace' );
 409  
 410      // Print styles.
 411      wp_enqueue_style( 'twenty-twenty-one-print-style', get_template_directory_uri() . '/assets/css/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );
 412  
 413      // Threaded comment reply styles.
 414      if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
 415          wp_enqueue_script( 'comment-reply' );
 416      }
 417  
 418      // Register the IE11 polyfill file.
 419      wp_register_script(
 420          'twenty-twenty-one-ie11-polyfills-asset',
 421          get_template_directory_uri() . '/assets/js/polyfills.js',
 422          array(),
 423          wp_get_theme()->get( 'Version' ),
 424          array( 'in_footer' => true )
 425      );
 426  
 427      // Register the IE11 polyfill loader.
 428      wp_register_script(
 429          'twenty-twenty-one-ie11-polyfills',
 430          null,
 431          array(),
 432          wp_get_theme()->get( 'Version' ),
 433          array( 'in_footer' => true )
 434      );
 435      wp_add_inline_script(
 436          'twenty-twenty-one-ie11-polyfills',
 437          wp_get_script_polyfill(
 438              $wp_scripts,
 439              array(
 440                  'Element.prototype.matches && Element.prototype.closest && window.NodeList && NodeList.prototype.forEach' => 'twenty-twenty-one-ie11-polyfills-asset',
 441              )
 442          )
 443      );
 444  
 445      // Main navigation scripts.
 446      if ( has_nav_menu( 'primary' ) ) {
 447          wp_enqueue_script(
 448              'twenty-twenty-one-primary-navigation-script',
 449              get_template_directory_uri() . '/assets/js/primary-navigation.js',
 450              array( 'twenty-twenty-one-ie11-polyfills' ),
 451              wp_get_theme()->get( 'Version' ),
 452              array(
 453                  'in_footer' => false, // Because involves header.
 454                  'strategy'  => 'defer',
 455              )
 456          );
 457      }
 458  
 459      // Responsive embeds script.
 460      wp_enqueue_script(
 461          'twenty-twenty-one-responsive-embeds-script',
 462          get_template_directory_uri() . '/assets/js/responsive-embeds.js',
 463          array( 'twenty-twenty-one-ie11-polyfills' ),
 464          wp_get_theme()->get( 'Version' ),
 465          array( 'in_footer' => true )
 466      );
 467  }
 468  add_action( 'wp_enqueue_scripts', 'twenty_twenty_one_scripts' );
 469  
 470  /**
 471   * Enqueues block editor script.
 472   *
 473   * @since Twenty Twenty-One 1.0
 474   *
 475   * @return void
 476   */
 477  function twentytwentyone_block_editor_script() {
 478  
 479      wp_enqueue_script( 'twentytwentyone-editor', get_theme_file_uri( '/assets/js/editor.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), array( 'in_footer' => true ) );
 480  }
 481  
 482  add_action( 'enqueue_block_editor_assets', 'twentytwentyone_block_editor_script' );
 483  
 484  /**
 485   * Fixes skip link focus in IE11.
 486   *
 487   * This does not enqueue the script because it is tiny and because it is only for IE11,
 488   * thus it does not warrant having an entire dedicated blocking script being loaded.
 489   *
 490   * @since Twenty Twenty-One 1.0
 491   * @deprecated Twenty Twenty-One 1.9 Removed from wp_print_footer_scripts action.
 492   *
 493   * @link https://git.io/vWdr2
 494   */
 495  function twenty_twenty_one_skip_link_focus_fix() {
 496  
 497      // If SCRIPT_DEBUG is defined and true, print the unminified file.
 498      if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
 499          echo '<script>';
 500          include get_template_directory() . '/assets/js/skip-link-focus-fix.js';
 501          echo '</script>';
 502      } else {
 503          // The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`.
 504          ?>
 505          <script>
 506          /(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",(function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}),!1);
 507          </script>
 508          <?php
 509      }
 510  }
 511  
 512  /**
 513   * Enqueues non-latin language styles.
 514   *
 515   * @since Twenty Twenty-One 1.0
 516   *
 517   * @return void
 518   */
 519  function twenty_twenty_one_non_latin_languages() {
 520      $custom_css = twenty_twenty_one_get_non_latin_css( 'front-end' );
 521  
 522      if ( $custom_css ) {
 523          wp_add_inline_style( 'twenty-twenty-one-style', $custom_css );
 524      }
 525  }
 526  add_action( 'wp_enqueue_scripts', 'twenty_twenty_one_non_latin_languages' );
 527  
 528  // SVG Icons class.
 529  require get_template_directory() . '/classes/class-twenty-twenty-one-svg-icons.php';
 530  
 531  // Custom color classes.
 532  require get_template_directory() . '/classes/class-twenty-twenty-one-custom-colors.php';
 533  new Twenty_Twenty_One_Custom_Colors();
 534  
 535  // Enhance the theme by hooking into WordPress.
 536  require get_template_directory() . '/inc/template-functions.php';
 537  
 538  // Menu functions and filters.
 539  require get_template_directory() . '/inc/menu-functions.php';
 540  
 541  // Custom template tags for the theme.
 542  require get_template_directory() . '/inc/template-tags.php';
 543  
 544  // Customizer additions.
 545  require get_template_directory() . '/classes/class-twenty-twenty-one-customize.php';
 546  new Twenty_Twenty_One_Customize();
 547  
 548  // Block Patterns.
 549  require get_template_directory() . '/inc/block-patterns.php';
 550  
 551  // Block Styles.
 552  require get_template_directory() . '/inc/block-styles.php';
 553  
 554  // Dark Mode.
 555  require_once get_template_directory() . '/classes/class-twenty-twenty-one-dark-mode.php';
 556  new Twenty_Twenty_One_Dark_Mode();
 557  
 558  /**
 559   * Enqueues scripts for the customizer preview.
 560   *
 561   * @since Twenty Twenty-One 1.0
 562   *
 563   * @return void
 564   */
 565  function twentytwentyone_customize_preview_init() {
 566      wp_enqueue_script(
 567          'twentytwentyone-customize-helpers',
 568          get_theme_file_uri( '/assets/js/customize-helpers.js' ),
 569          array(),
 570          wp_get_theme()->get( 'Version' ),
 571          array( 'in_footer' => true )
 572      );
 573  
 574      wp_enqueue_script(
 575          'twentytwentyone-customize-preview',
 576          get_theme_file_uri( '/assets/js/customize-preview.js' ),
 577          array( 'customize-preview', 'customize-selective-refresh', 'jquery', 'twentytwentyone-customize-helpers' ),
 578          wp_get_theme()->get( 'Version' ),
 579          array( 'in_footer' => true )
 580      );
 581  }
 582  add_action( 'customize_preview_init', 'twentytwentyone_customize_preview_init' );
 583  
 584  /**
 585   * Enqueues scripts for the customizer.
 586   *
 587   * @since Twenty Twenty-One 1.0
 588   *
 589   * @return void
 590   */
 591  function twentytwentyone_customize_controls_enqueue_scripts() {
 592  
 593      wp_enqueue_script(
 594          'twentytwentyone-customize-helpers',
 595          get_theme_file_uri( '/assets/js/customize-helpers.js' ),
 596          array(),
 597          wp_get_theme()->get( 'Version' ),
 598          array( 'in_footer' => true )
 599      );
 600  }
 601  add_action( 'customize_controls_enqueue_scripts', 'twentytwentyone_customize_controls_enqueue_scripts' );
 602  
 603  /**
 604   * Calculates classes for the main <html> element.
 605   *
 606   * @since Twenty Twenty-One 1.0
 607   *
 608   * @return void
 609   */
 610  function twentytwentyone_the_html_classes() {
 611      /**
 612       * Filters the classes for the main <html> element.
 613       *
 614       * @since Twenty Twenty-One 1.0
 615       *
 616       * @param string The list of classes. Default empty string.
 617       */
 618      $classes = apply_filters( 'twentytwentyone_html_classes', '' );
 619      if ( ! $classes ) {
 620          return;
 621      }
 622      echo 'class="' . esc_attr( $classes ) . '"';
 623  }
 624  
 625  /**
 626   * Adds "is-IE" class to body if the user is on Internet Explorer.
 627   *
 628   * @since Twenty Twenty-One 1.0
 629   *
 630   * @return void
 631   */
 632  function twentytwentyone_add_ie_class() {
 633      ?>
 634      <script>
 635      if ( -1 !== navigator.userAgent.indexOf( 'MSIE' ) || -1 !== navigator.appVersion.indexOf( 'Trident/' ) ) {
 636          document.body.classList.add( 'is-IE' );
 637      }
 638      </script>
 639      <?php
 640  }
 641  add_action( 'wp_footer', 'twentytwentyone_add_ie_class' );
 642  
 643  if ( ! function_exists( 'wp_get_list_item_separator' ) ) :
 644      /**
 645       * Retrieves the list item separator based on the locale.
 646       *
 647       * Added for backward compatibility to support pre-6.0.0 WordPress versions.
 648       *
 649       * @since 6.0.0
 650       */
 651  	function wp_get_list_item_separator() {
 652          /* translators: Used between list items, there is a space after the comma. */
 653          return __( ', ', 'twentytwentyone' );
 654      }
 655  endif;


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref