File manager - Edit - /home/premiey/www/wp-includes/images/media/functions.php.tar
Back
home/premiey/www/wp-content/plugins/really-simple-ssl/functions.php 0000666 00000005734 15165257637 0021706 0 ustar 00 <?php defined('ABSPATH') or die(); /** * Only functions also required on front-end here */ /** * Get a Really Simple SSL option by name * * @param string $name * @param mixed $default * * @return mixed */ function rsssl_get_option( string $name, $default=false ) { $name = sanitize_title($name); if ( is_multisite() && rsssl_is_networkwide_active() ) { $options = get_site_option( 'rsssl_options', [] ); } else { $options = get_option( 'rsssl_options', [] ); } //fallback, will be removed after 6.2 //because we only check if the option is not saved in the new style, this if should normally never get executed. if ( !isset($options[$name]) && ($name === 'ssl_enabled' || $name === 'redirect' || $name === "mixed_content_fixer" || $name === 'dismiss_all_notices' ) ) { $options = rsssl_get_legacy_option($options, $name); } $value = $options[ $name ] ?? false; if ( $value===false && $default!==false ) { $value = $default; } if ($value===1) { $value = true; } return apply_filters("rsssl_option_$name", $value, $name); } /** * Check if we should treat the plugin as networkwide or not. * Note that this function returns false for single sites! Always use icw is_multisite() * * @return bool */ function rsssl_is_networkwide_active(){ if ( !is_multisite() ) { return false; } if ( !function_exists('is_plugin_active_for_network') ) { require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); } if ( is_plugin_active_for_network(rsssl_plugin) ) { return true; } return false; } /** * if the option is does not exist in our new array, check if it's available in the old option. If so, use that one * @deprecated to be used until 6.2, as fallback for failed upgrades in some specific edge case situations * @param array $options * @param string $name * * @return array */ function rsssl_get_legacy_option( array $options, string $name): array { $old_options = is_multisite() ? get_site_option('rlrsssl_network_options') : get_option( 'rlrsssl_options' ); if ( $old_options ) { if ( $name === 'ssl_enabled' && isset( $old_options['ssl_enabled']) ) { $options['ssl_enabled'] = $old_options['ssl_enabled']; } else if ( $name === 'dismiss_all_notices' && isset( $old_options['dismiss_all_notices']) ) { $options['dismiss_all_notices'] = $old_options['dismiss_all_notices']; } else if ( $name === 'dismiss_all_notices' && isset( $old_options['dismiss_all_notices']) ) { $options['dismiss_all_notices'] = $old_options['dismiss_all_notices']; } else if ( $name === 'mixed_content_fixer' && isset($old_options['autoreplace_insecure_links']) ) { $options['mixed_content_fixer'] = $old_options['autoreplace_insecure_links']; } else if ( $name === 'redirect' ){ if ( isset($old_options['htaccess_redirect']) && $old_options['htaccess_redirect'] ) { $options['redirect'] = 'htaccess'; } else if (isset($old_options['wp_redirect']) && $old_options['wp_redirect']) { $options['redirect'] = 'wp_redirect'; } } } return $options; } home/premiey/www/wp-content/themes/twentytwenty/functions.php 0000666 00000065722 15165344143 0020731 0 ustar 00 <?php /** * Twenty Twenty functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package WordPress * @subpackage Twenty_Twenty * @since Twenty Twenty 1.0 */ /** * Table of Contents: * Theme Support * Required Files * Register Styles * Register Scripts * Register Menus * Custom Logo * WP Body Open * Register Sidebars * Enqueue Block Editor Assets * Enqueue Classic Editor Styles * Block Editor Settings */ /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. * * @since Twenty Twenty 1.0 */ function twentytwenty_theme_support() { // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); // Custom background color. add_theme_support( 'custom-background', array( 'default-color' => 'f5efe0', ) ); // Set content-width. global $content_width; if ( ! isset( $content_width ) ) { $content_width = 580; } /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); // Set post thumbnail size. set_post_thumbnail_size( 1200, 9999 ); // Add custom image size used in Cover Template. add_image_size( 'twentytwenty-fullscreen', 1980, 9999 ); // Custom logo. $logo_width = 120; $logo_height = 90; // If the retina setting is active, double the recommended width and height. if ( get_theme_mod( 'retina_logo', false ) ) { $logo_width = floor( $logo_width * 2 ); $logo_height = floor( $logo_height * 2 ); } add_theme_support( 'custom-logo', array( 'height' => $logo_height, 'width' => $logo_width, 'flex-height' => true, 'flex-width' => true, ) ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded <title> tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'script', 'style', 'navigation-widgets', ) ); /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Twenty Twenty, use a find and replace * to change 'twentytwenty' to the name of your theme in all the template files. */ load_theme_textdomain( 'twentytwenty' ); // Add support for full and wide align images. add_theme_support( 'align-wide' ); // Add support for responsive embeds. add_theme_support( 'responsive-embeds' ); /* * Adds starter content to highlight the theme on fresh sites. * This is done conditionally to avoid loading the starter content on every * page load, as it is a one-off operation only needed once in the customizer. */ if ( is_customize_preview() ) { require get_template_directory() . '/inc/starter-content.php'; add_theme_support( 'starter-content', twentytwenty_get_starter_content() ); } // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /* * Adds `async` and `defer` support for scripts registered or enqueued * by the theme. */ $loader = new TwentyTwenty_Script_Loader(); add_filter( 'script_loader_tag', array( $loader, 'filter_script_loader_tag' ), 10, 2 ); } add_action( 'after_setup_theme', 'twentytwenty_theme_support' ); /** * REQUIRED FILES * Include required files. */ require get_template_directory() . '/inc/template-tags.php'; // Handle SVG icons. require get_template_directory() . '/classes/class-twentytwenty-svg-icons.php'; require get_template_directory() . '/inc/svg-icons.php'; // Handle Customizer settings. require get_template_directory() . '/classes/class-twentytwenty-customize.php'; // Require Separator Control class. require get_template_directory() . '/classes/class-twentytwenty-separator-control.php'; // Custom comment walker. require get_template_directory() . '/classes/class-twentytwenty-walker-comment.php'; // Custom page walker. require get_template_directory() . '/classes/class-twentytwenty-walker-page.php'; // Custom script loader class. require get_template_directory() . '/classes/class-twentytwenty-script-loader.php'; // Non-latin language handling. require get_template_directory() . '/classes/class-twentytwenty-non-latin-languages.php'; // Custom CSS. require get_template_directory() . '/inc/custom-css.php'; // Block Patterns. require get_template_directory() . '/inc/block-patterns.php'; /** * Register and Enqueue Styles. * * @since Twenty Twenty 1.0 */ function twentytwenty_register_styles() { $theme_version = wp_get_theme()->get( 'Version' ); wp_enqueue_style( 'twentytwenty-style', get_stylesheet_uri(), array(), $theme_version ); wp_style_add_data( 'twentytwenty-style', 'rtl', 'replace' ); // Add output of Customizer settings as inline style. wp_add_inline_style( 'twentytwenty-style', twentytwenty_get_customizer_css( 'front-end' ) ); // Add print CSS. wp_enqueue_style( 'twentytwenty-print-style', get_template_directory_uri() . '/print.css', null, $theme_version, 'print' ); } add_action( 'wp_enqueue_scripts', 'twentytwenty_register_styles' ); /** * Register and Enqueue Scripts. * * @since Twenty Twenty 1.0 */ function twentytwenty_register_scripts() { $theme_version = wp_get_theme()->get( 'Version' ); if ( ( ! is_admin() ) && is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'twentytwenty-js', get_template_directory_uri() . '/assets/js/index.js', array(), $theme_version, false ); wp_script_add_data( 'twentytwenty-js', 'async', true ); } add_action( 'wp_enqueue_scripts', 'twentytwenty_register_scripts' ); /** * Fix skip link focus in IE11. * * This does not enqueue the script because it is tiny and because it is only for IE11, * thus it does not warrant having an entire dedicated blocking script being loaded. * * @since Twenty Twenty 1.0 * * @link https://git.io/vWdr2 */ function twentytwenty_skip_link_focus_fix() { // The following is minified via `terser --compress --mangle -- assets/js/skip-link-focus-fix.js`. ?> <script> /(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); </script> <?php } add_action( 'wp_print_footer_scripts', 'twentytwenty_skip_link_focus_fix' ); /** * Enqueue non-latin language styles. * * @since Twenty Twenty 1.0 * * @return void */ function twentytwenty_non_latin_languages() { $custom_css = TwentyTwenty_Non_Latin_Languages::get_non_latin_css( 'front-end' ); if ( $custom_css ) { wp_add_inline_style( 'twentytwenty-style', $custom_css ); } } add_action( 'wp_enqueue_scripts', 'twentytwenty_non_latin_languages' ); /** * Register navigation menus uses wp_nav_menu in five places. * * @since Twenty Twenty 1.0 */ function twentytwenty_menus() { $locations = array( 'primary' => __( 'Desktop Horizontal Menu', 'twentytwenty' ), 'expanded' => __( 'Desktop Expanded Menu', 'twentytwenty' ), 'mobile' => __( 'Mobile Menu', 'twentytwenty' ), 'footer' => __( 'Footer Menu', 'twentytwenty' ), 'social' => __( 'Social Menu', 'twentytwenty' ), ); register_nav_menus( $locations ); } add_action( 'init', 'twentytwenty_menus' ); /** * Get the information about the logo. * * @since Twenty Twenty 1.0 * * @param string $html The HTML output from get_custom_logo (core function). * @return string */ function twentytwenty_get_custom_logo( $html ) { $logo_id = get_theme_mod( 'custom_logo' ); if ( ! $logo_id ) { return $html; } $logo = wp_get_attachment_image_src( $logo_id, 'full' ); if ( $logo ) { // For clarity. $logo_width = esc_attr( $logo[1] ); $logo_height = esc_attr( $logo[2] ); // If the retina logo setting is active, reduce the width/height by half. if ( get_theme_mod( 'retina_logo', false ) ) { $logo_width = floor( $logo_width / 2 ); $logo_height = floor( $logo_height / 2 ); $search = array( '/width=\"\d+\"/iU', '/height=\"\d+\"/iU', ); $replace = array( "width=\"{$logo_width}\"", "height=\"{$logo_height}\"", ); // Add a style attribute with the height, or append the height to the style attribute if the style attribute already exists. if ( strpos( $html, ' style=' ) === false ) { $search[] = '/(src=)/'; $replace[] = "style=\"height: {$logo_height}px;\" src="; } else { $search[] = '/(style="[^"]*)/'; $replace[] = "$1 height: {$logo_height}px;"; } $html = preg_replace( $search, $replace, $html ); } } return $html; } add_filter( 'get_custom_logo', 'twentytwenty_get_custom_logo' ); if ( ! function_exists( 'wp_body_open' ) ) { /** * Shim for wp_body_open, ensuring backward compatibility with versions of WordPress older than 5.2. * * @since Twenty Twenty 1.0 */ function wp_body_open() { /** This action is documented in wp-includes/general-template.php */ do_action( 'wp_body_open' ); } } /** * Include a skip to content link at the top of the page so that users can bypass the menu. * * @since Twenty Twenty 1.0 */ function twentytwenty_skip_link() { echo '<a class="skip-link screen-reader-text" href="#site-content">' . __( 'Skip to the content', 'twentytwenty' ) . '</a>'; } add_action( 'wp_body_open', 'twentytwenty_skip_link', 5 ); /** * Register widget areas. * * @since Twenty Twenty 1.0 * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function twentytwenty_sidebar_registration() { // Arguments used in all register_sidebar() calls. $shared_args = array( 'before_title' => '<h2 class="widget-title subheading heading-size-3">', 'after_title' => '</h2>', 'before_widget' => '<div class="widget %2$s"><div class="widget-content">', 'after_widget' => '</div></div>', ); // Footer #1. register_sidebar( array_merge( $shared_args, array( 'name' => __( 'Footer #1', 'twentytwenty' ), 'id' => 'sidebar-1', 'description' => __( 'Widgets in this area will be displayed in the first column in the footer.', 'twentytwenty' ), ) ) ); // Footer #2. register_sidebar( array_merge( $shared_args, array( 'name' => __( 'Footer #2', 'twentytwenty' ), 'id' => 'sidebar-2', 'description' => __( 'Widgets in this area will be displayed in the second column in the footer.', 'twentytwenty' ), ) ) ); } add_action( 'widgets_init', 'twentytwenty_sidebar_registration' ); /** * Enqueue supplemental block editor styles. * * @since Twenty Twenty 1.0 */ function twentytwenty_block_editor_styles() { // Enqueue the editor styles. wp_enqueue_style( 'twentytwenty-block-editor-styles', get_theme_file_uri( '/assets/css/editor-style-block.css' ), array(), wp_get_theme()->get( 'Version' ), 'all' ); wp_style_add_data( 'twentytwenty-block-editor-styles', 'rtl', 'replace' ); // Add inline style from the Customizer. wp_add_inline_style( 'twentytwenty-block-editor-styles', twentytwenty_get_customizer_css( 'block-editor' ) ); // Add inline style for non-latin fonts. wp_add_inline_style( 'twentytwenty-block-editor-styles', TwentyTwenty_Non_Latin_Languages::get_non_latin_css( 'block-editor' ) ); // Enqueue the editor script. wp_enqueue_script( 'twentytwenty-block-editor-script', get_theme_file_uri( '/assets/js/editor-script-block.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), true ); } add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 ); /** * Enqueue classic editor styles. * * @since Twenty Twenty 1.0 */ function twentytwenty_classic_editor_styles() { $classic_editor_styles = array( '/assets/css/editor-style-classic.css', ); add_editor_style( $classic_editor_styles ); } add_action( 'init', 'twentytwenty_classic_editor_styles' ); /** * Output Customizer settings in the classic editor. * Adds styles to the head of the TinyMCE iframe. Kudos to @Otto42 for the original solution. * * @since Twenty Twenty 1.0 * * @param array $mce_init TinyMCE styles. * @return array TinyMCE styles. */ function twentytwenty_add_classic_editor_customizer_styles( $mce_init ) { $styles = twentytwenty_get_customizer_css( 'classic-editor' ); if ( ! isset( $mce_init['content_style'] ) ) { $mce_init['content_style'] = $styles . ' '; } else { $mce_init['content_style'] .= ' ' . $styles . ' '; } return $mce_init; } add_filter( 'tiny_mce_before_init', 'twentytwenty_add_classic_editor_customizer_styles' ); /** * Output non-latin font styles in the classic editor. * Adds styles to the head of the TinyMCE iframe. Kudos to @Otto42 for the original solution. * * @param array $mce_init TinyMCE styles. * @return array TinyMCE styles. */ function twentytwenty_add_classic_editor_non_latin_styles( $mce_init ) { $styles = TwentyTwenty_Non_Latin_Languages::get_non_latin_css( 'classic-editor' ); // Return if there are no styles to add. if ( ! $styles ) { return $mce_init; } if ( ! isset( $mce_init['content_style'] ) ) { $mce_init['content_style'] = $styles . ' '; } else { $mce_init['content_style'] .= ' ' . $styles . ' '; } return $mce_init; } add_filter( 'tiny_mce_before_init', 'twentytwenty_add_classic_editor_non_latin_styles' ); /** * Block Editor Settings. * Add custom colors and font sizes to the block editor. * * @since Twenty Twenty 1.0 */ function twentytwenty_block_editor_settings() { // Block Editor Palette. $editor_color_palette = array( array( 'name' => __( 'Accent Color', 'twentytwenty' ), 'slug' => 'accent', 'color' => twentytwenty_get_color_for_area( 'content', 'accent' ), ), array( 'name' => _x( 'Primary', 'color', 'twentytwenty' ), 'slug' => 'primary', 'color' => twentytwenty_get_color_for_area( 'content', 'text' ), ), array( 'name' => _x( 'Secondary', 'color', 'twentytwenty' ), 'slug' => 'secondary', 'color' => twentytwenty_get_color_for_area( 'content', 'secondary' ), ), array( 'name' => __( 'Subtle Background', 'twentytwenty' ), 'slug' => 'subtle-background', 'color' => twentytwenty_get_color_for_area( 'content', 'borders' ), ), ); // Add the background option. $background_color = get_theme_mod( 'background_color' ); if ( ! $background_color ) { $background_color_arr = get_theme_support( 'custom-background' ); $background_color = $background_color_arr[0]['default-color']; } $editor_color_palette[] = array( 'name' => __( 'Background Color', 'twentytwenty' ), 'slug' => 'background', 'color' => '#' . $background_color, ); // If we have accent colors, add them to the block editor palette. if ( $editor_color_palette ) { add_theme_support( 'editor-color-palette', $editor_color_palette ); } // Block Editor Font Sizes. add_theme_support( 'editor-font-sizes', array( array( 'name' => _x( 'Small', 'Name of the small font size in the block editor', 'twentytwenty' ), 'shortName' => _x( 'S', 'Short name of the small font size in the block editor.', 'twentytwenty' ), 'size' => 18, 'slug' => 'small', ), array( 'name' => _x( 'Regular', 'Name of the regular font size in the block editor', 'twentytwenty' ), 'shortName' => _x( 'M', 'Short name of the regular font size in the block editor.', 'twentytwenty' ), 'size' => 21, 'slug' => 'normal', ), array( 'name' => _x( 'Large', 'Name of the large font size in the block editor', 'twentytwenty' ), 'shortName' => _x( 'L', 'Short name of the large font size in the block editor.', 'twentytwenty' ), 'size' => 26.25, 'slug' => 'large', ), array( 'name' => _x( 'Larger', 'Name of the larger font size in the block editor', 'twentytwenty' ), 'shortName' => _x( 'XL', 'Short name of the larger font size in the block editor.', 'twentytwenty' ), 'size' => 32, 'slug' => 'larger', ), ) ); add_theme_support( 'editor-styles' ); // If we have a dark background color then add support for dark editor style. // We can determine if the background color is dark by checking if the text-color is white. if ( '#ffffff' === strtolower( twentytwenty_get_color_for_area( 'content', 'text' ) ) ) { add_theme_support( 'dark-editor-style' ); } } add_action( 'after_setup_theme', 'twentytwenty_block_editor_settings' ); /** * Overwrite default more tag with styling and screen reader markup. * * @param string $html The default output HTML for the more tag. * @return string */ function twentytwenty_read_more_tag( $html ) { return preg_replace( '/<a(.*)>(.*)<\/a>/iU', sprintf( '<div class="read-more-button-wrap"><a$1><span class="faux-button">$2</span> <span class="screen-reader-text">"%1$s"</span></a></div>', get_the_title( get_the_ID() ) ), $html ); } add_filter( 'the_content_more_link', 'twentytwenty_read_more_tag' ); /** * Enqueues scripts for customizer controls & settings. * * @since Twenty Twenty 1.0 * * @return void */ function twentytwenty_customize_controls_enqueue_scripts() { $theme_version = wp_get_theme()->get( 'Version' ); // Add main customizer js file. wp_enqueue_script( 'twentytwenty-customize', get_template_directory_uri() . '/assets/js/customize.js', array( 'jquery' ), $theme_version, false ); // Add script for color calculations. wp_enqueue_script( 'twentytwenty-color-calculations', get_template_directory_uri() . '/assets/js/color-calculations.js', array( 'wp-color-picker' ), $theme_version, false ); // Add script for controls. wp_enqueue_script( 'twentytwenty-customize-controls', get_template_directory_uri() . '/assets/js/customize-controls.js', array( 'twentytwenty-color-calculations', 'customize-controls', 'underscore', 'jquery' ), $theme_version, false ); wp_localize_script( 'twentytwenty-customize-controls', 'twentyTwentyBgColors', twentytwenty_get_customizer_color_vars() ); } add_action( 'customize_controls_enqueue_scripts', 'twentytwenty_customize_controls_enqueue_scripts' ); /** * Enqueue scripts for the customizer preview. * * @since Twenty Twenty 1.0 * * @return void */ function twentytwenty_customize_preview_init() { $theme_version = wp_get_theme()->get( 'Version' ); wp_enqueue_script( 'twentytwenty-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview', 'customize-selective-refresh', 'jquery' ), $theme_version, true ); wp_localize_script( 'twentytwenty-customize-preview', 'twentyTwentyBgColors', twentytwenty_get_customizer_color_vars() ); wp_localize_script( 'twentytwenty-customize-preview', 'twentyTwentyPreviewEls', twentytwenty_get_elements_array() ); wp_add_inline_script( 'twentytwenty-customize-preview', sprintf( 'wp.customize.selectiveRefresh.partialConstructor[ %1$s ].prototype.attrs = %2$s;', wp_json_encode( 'cover_opacity' ), wp_json_encode( twentytwenty_customize_opacity_range() ) ) ); } add_action( 'customize_preview_init', 'twentytwenty_customize_preview_init' ); /** * Get accessible color for an area. * * @since Twenty Twenty 1.0 * * @param string $area The area we want to get the colors for. * @param string $context Can be 'text' or 'accent'. * @return string Returns a HEX color. */ function twentytwenty_get_color_for_area( $area = 'content', $context = 'text' ) { // Get the value from the theme-mod. $settings = get_theme_mod( 'accent_accessible_colors', array( 'content' => array( 'text' => '#000000', 'accent' => '#cd2653', 'secondary' => '#6d6d6d', 'borders' => '#dcd7ca', ), 'header-footer' => array( 'text' => '#000000', 'accent' => '#cd2653', 'secondary' => '#6d6d6d', 'borders' => '#dcd7ca', ), ) ); // If we have a value return it. if ( isset( $settings[ $area ] ) && isset( $settings[ $area ][ $context ] ) ) { return $settings[ $area ][ $context ]; } // Return false if the option doesn't exist. return false; } /** * Returns an array of variables for the customizer preview. * * @since Twenty Twenty 1.0 * * @return array */ function twentytwenty_get_customizer_color_vars() { $colors = array( 'content' => array( 'setting' => 'background_color', ), 'header-footer' => array( 'setting' => 'header_footer_background_color', ), ); return $colors; } /** * Get an array of elements. * * @since Twenty Twenty 1.0 * * @return array */ function twentytwenty_get_elements_array() { // The array is formatted like this: // [key-in-saved-setting][sub-key-in-setting][css-property] = [elements]. $elements = array( 'content' => array( 'accent' => array( 'color' => array( '.color-accent', '.color-accent-hover:hover', '.color-accent-hover:focus', ':root .has-accent-color', '.has-drop-cap:not(:focus):first-letter', '.wp-block-button.is-style-outline', 'a' ), 'border-color' => array( 'blockquote', '.border-color-accent', '.border-color-accent-hover:hover', '.border-color-accent-hover:focus' ), 'background-color' => array( 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file .wp-block-file__button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]', '.bg-accent', '.bg-accent-hover:hover', '.bg-accent-hover:focus', ':root .has-accent-background-color', '.comment-reply-link' ), 'fill' => array( '.fill-children-accent', '.fill-children-accent *' ), ), 'background' => array( 'color' => array( ':root .has-background-color', 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file__button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]', '.wp-block-button', '.comment-reply-link', '.has-background.has-primary-background-color:not(.has-text-color)', '.has-background.has-primary-background-color *:not(.has-text-color)', '.has-background.has-accent-background-color:not(.has-text-color)', '.has-background.has-accent-background-color *:not(.has-text-color)' ), 'background-color' => array( ':root .has-background-background-color' ), ), 'text' => array( 'color' => array( 'body', '.entry-title a', ':root .has-primary-color' ), 'background-color' => array( ':root .has-primary-background-color' ), ), 'secondary' => array( 'color' => array( 'cite', 'figcaption', '.wp-caption-text', '.post-meta', '.entry-content .wp-block-archives li', '.entry-content .wp-block-categories li', '.entry-content .wp-block-latest-posts li', '.wp-block-latest-comments__comment-date', '.wp-block-latest-posts__post-date', '.wp-block-embed figcaption', '.wp-block-image figcaption', '.wp-block-pullquote cite', '.comment-metadata', '.comment-respond .comment-notes', '.comment-respond .logged-in-as', '.pagination .dots', '.entry-content hr:not(.has-background)', 'hr.styled-separator', ':root .has-secondary-color' ), 'background-color' => array( ':root .has-secondary-background-color' ), ), 'borders' => array( 'border-color' => array( 'pre', 'fieldset', 'input', 'textarea', 'table', 'table *', 'hr' ), 'background-color' => array( 'caption', 'code', 'code', 'kbd', 'samp', '.wp-block-table.is-style-stripes tbody tr:nth-child(odd)', ':root .has-subtle-background-background-color' ), 'border-bottom-color' => array( '.wp-block-table.is-style-stripes' ), 'border-top-color' => array( '.wp-block-latest-posts.is-grid li' ), 'color' => array( ':root .has-subtle-background-color' ), ), ), 'header-footer' => array( 'accent' => array( 'color' => array( 'body:not(.overlay-header) .primary-menu > li > a', 'body:not(.overlay-header) .primary-menu > li > .icon', '.modal-menu a', '.footer-menu a, .footer-widgets a', '#site-footer .wp-block-button.is-style-outline', '.wp-block-pullquote:before', '.singular:not(.overlay-header) .entry-header a', '.archive-header a', '.header-footer-group .color-accent', '.header-footer-group .color-accent-hover:hover' ), 'background-color' => array( '.social-icons a', '#site-footer button:not(.toggle)', '#site-footer .button', '#site-footer .faux-button', '#site-footer .wp-block-button__link', '#site-footer .wp-block-file__button', '#site-footer input[type="button"]', '#site-footer input[type="reset"]', '#site-footer input[type="submit"]' ), ), 'background' => array( 'color' => array( '.social-icons a', 'body:not(.overlay-header) .primary-menu ul', '.header-footer-group button', '.header-footer-group .button', '.header-footer-group .faux-button', '.header-footer-group .wp-block-button:not(.is-style-outline) .wp-block-button__link', '.header-footer-group .wp-block-file__button', '.header-footer-group input[type="button"]', '.header-footer-group input[type="reset"]', '.header-footer-group input[type="submit"]' ), 'background-color' => array( '#site-header', '.footer-nav-widgets-wrapper', '#site-footer', '.menu-modal', '.menu-modal-inner', '.search-modal-inner', '.archive-header', '.singular .entry-header', '.singular .featured-media:before', '.wp-block-pullquote:before' ), ), 'text' => array( 'color' => array( '.header-footer-group', 'body:not(.overlay-header) #site-header .toggle', '.menu-modal .toggle' ), 'background-color' => array( 'body:not(.overlay-header) .primary-menu ul' ), 'border-bottom-color' => array( 'body:not(.overlay-header) .primary-menu > li > ul:after' ), 'border-left-color' => array( 'body:not(.overlay-header) .primary-menu ul ul:after' ), ), 'secondary' => array( 'color' => array( '.site-description', 'body:not(.overlay-header) .toggle-inner .toggle-text', '.widget .post-date', '.widget .rss-date', '.widget_archive li', '.widget_categories li', '.widget cite', '.widget_pages li', '.widget_meta li', '.widget_nav_menu li', '.powered-by-wordpress', '.to-the-top', '.singular .entry-header .post-meta', '.singular:not(.overlay-header) .entry-header .post-meta a' ), ), 'borders' => array( 'border-color' => array( '.header-footer-group pre', '.header-footer-group fieldset', '.header-footer-group input', '.header-footer-group textarea', '.header-footer-group table', '.header-footer-group table *', '.footer-nav-widgets-wrapper', '#site-footer', '.menu-modal nav *', '.footer-widgets-outer-wrapper', '.footer-top' ), 'background-color' => array( '.header-footer-group table caption', 'body:not(.overlay-header) .header-inner .toggle-wrapper::before' ), ), ), ); /** * Filters Twenty Twenty theme elements. * * @since Twenty Twenty 1.0 * * @param array Array of elements. */ return apply_filters( 'twentytwenty_get_elements_array', $elements ); } home/premiey/www/wp-content/themes/twentytwentytwo/functions.php 0000666 00000007060 15165376210 0021452 0 ustar 00 <?php /** * Twenty Twenty-Two functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package WordPress * @subpackage Twenty_Twenty_Two * @since Twenty Twenty-Two 1.0 */ if ( ! function_exists( 'twentytwentytwo_support' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * @since Twenty Twenty-Two 1.0 * * @return void */ function twentytwentytwo_support() { // Add support for block styles. add_theme_support( 'wp-block-styles' ); // Enqueue editor styles. add_editor_style( 'style.css' ); } endif; add_action( 'after_setup_theme', 'twentytwentytwo_support' ); if ( ! function_exists( 'twentytwentytwo_styles' ) ) : /** * Enqueue styles. * * @since Twenty Twenty-Two 1.0 * * @return void */ function twentytwentytwo_styles() { // Register theme stylesheet. $theme_version = wp_get_theme()->get( 'Version' ); $version_string = is_string( $theme_version ) ? $theme_version : false; wp_register_style( 'twentytwentytwo-style', get_template_directory_uri() . '/style.css', array(), $version_string ); // Add styles inline. wp_add_inline_style( 'twentytwentytwo-style', twentytwentytwo_get_font_face_styles() ); // Enqueue theme stylesheet. wp_enqueue_style( 'twentytwentytwo-style' ); } endif; add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' ); if ( ! function_exists( 'twentytwentytwo_editor_styles' ) ) : /** * Enqueue editor styles. * * @since Twenty Twenty-Two 1.0 * * @return void */ function twentytwentytwo_editor_styles() { // Add styles inline. wp_add_inline_style( 'wp-block-library', twentytwentytwo_get_font_face_styles() ); } endif; add_action( 'admin_init', 'twentytwentytwo_editor_styles' ); if ( ! function_exists( 'twentytwentytwo_get_font_face_styles' ) ) : /** * Get font face styles. * Called by functions twentytwentytwo_styles() and twentytwentytwo_editor_styles() above. * * @since Twenty Twenty-Two 1.0 * * @return string */ function twentytwentytwo_get_font_face_styles() { return " @font-face{ font-family: 'Source Serif Pro'; font-weight: 200 900; font-style: normal; font-stretch: normal; font-display: swap; src: url('" . get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Roman.ttf.woff2' ) . "') format('woff2'); } @font-face{ font-family: 'Source Serif Pro'; font-weight: 200 900; font-style: italic; font-stretch: normal; font-display: swap; src: url('" . get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Italic.ttf.woff2' ) . "') format('woff2'); } "; } endif; if ( ! function_exists( 'twentytwentytwo_preload_webfonts' ) ) : /** * Preloads the main web font to improve performance. * * Only the main web font (font-style: normal) is preloaded here since that font is always relevant (it is used * on every heading, for example). The other font is only needed if there is any applicable content in italic style, * and therefore preloading it would in most cases regress performance when that font would otherwise not be loaded * at all. * * @since Twenty Twenty-Two 1.0 * * @return void */ function twentytwentytwo_preload_webfonts() { ?> <link rel="preload" href="<?php echo esc_url( get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Roman.ttf.woff2' ) ); ?>" as="font" type="font/woff2" crossorigin> <?php } endif; add_action( 'wp_head', 'twentytwentytwo_preload_webfonts' ); // Add block patterns require get_template_directory() . '/inc/block-patterns.php'; home/premiey/www/wp-content/themes/twentytwentyone/functions.php 0000666 00000045006 15165376445 0021436 0 ustar 00 <?php /** * Functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package WordPress * @subpackage Twenty_Twenty_One * @since Twenty Twenty-One 1.0 */ // This theme requires WordPress 5.3 or later. if ( version_compare( $GLOBALS['wp_version'], '5.3', '<' ) ) { require get_template_directory() . '/inc/back-compat.php'; } if ( ! function_exists( 'twenty_twenty_one_setup' ) ) { /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. * * @since Twenty Twenty-One 1.0 * * @return void */ function twenty_twenty_one_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Twenty Twenty-One, use a find and replace * to change 'twentytwentyone' to the name of your theme in all the template files. */ load_theme_textdomain( 'twentytwentyone', get_template_directory() . '/languages' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * This theme does not use a hard-coded <title> tag in the document head, * WordPress will provide it for us. */ add_theme_support( 'title-tag' ); /** * Add post-formats support. */ add_theme_support( 'post-formats', array( 'link', 'aside', 'gallery', 'image', 'quote', 'status', 'video', 'audio', 'chat', ) ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 1568, 9999 ); register_nav_menus( array( 'primary' => esc_html__( 'Primary menu', 'twentytwentyone' ), 'footer' => esc_html__( 'Secondary menu', 'twentytwentyone' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', 'navigation-widgets', ) ); /* * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ $logo_width = 300; $logo_height = 100; add_theme_support( 'custom-logo', array( 'height' => $logo_height, 'width' => $logo_width, 'flex-width' => true, 'flex-height' => true, 'unlink-homepage-logo' => true, ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // Add support for Block Styles. add_theme_support( 'wp-block-styles' ); // Add support for full and wide align images. add_theme_support( 'align-wide' ); // Add support for editor styles. add_theme_support( 'editor-styles' ); $background_color = get_theme_mod( 'background_color', 'D1E4DD' ); if ( 127 > Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) ) { add_theme_support( 'dark-editor-style' ); } $editor_stylesheet_path = './assets/css/style-editor.css'; // Note, the is_IE global variable is defined by WordPress and is used // to detect if the current browser is internet explorer. global $is_IE; if ( $is_IE ) { $editor_stylesheet_path = './assets/css/ie-editor.css'; } // Enqueue editor styles. add_editor_style( $editor_stylesheet_path ); // Add custom editor font sizes. add_theme_support( 'editor-font-sizes', array( array( 'name' => esc_html__( 'Extra small', 'twentytwentyone' ), 'shortName' => esc_html_x( 'XS', 'Font size', 'twentytwentyone' ), 'size' => 16, 'slug' => 'extra-small', ), array( 'name' => esc_html__( 'Small', 'twentytwentyone' ), 'shortName' => esc_html_x( 'S', 'Font size', 'twentytwentyone' ), 'size' => 18, 'slug' => 'small', ), array( 'name' => esc_html__( 'Normal', 'twentytwentyone' ), 'shortName' => esc_html_x( 'M', 'Font size', 'twentytwentyone' ), 'size' => 20, 'slug' => 'normal', ), array( 'name' => esc_html__( 'Large', 'twentytwentyone' ), 'shortName' => esc_html_x( 'L', 'Font size', 'twentytwentyone' ), 'size' => 24, 'slug' => 'large', ), array( 'name' => esc_html__( 'Extra large', 'twentytwentyone' ), 'shortName' => esc_html_x( 'XL', 'Font size', 'twentytwentyone' ), 'size' => 40, 'slug' => 'extra-large', ), array( 'name' => esc_html__( 'Huge', 'twentytwentyone' ), 'shortName' => esc_html_x( 'XXL', 'Font size', 'twentytwentyone' ), 'size' => 96, 'slug' => 'huge', ), array( 'name' => esc_html__( 'Gigantic', 'twentytwentyone' ), 'shortName' => esc_html_x( 'XXXL', 'Font size', 'twentytwentyone' ), 'size' => 144, 'slug' => 'gigantic', ), ) ); // Custom background color. add_theme_support( 'custom-background', array( 'default-color' => 'd1e4dd', ) ); // Editor color palette. $black = '#000000'; $dark_gray = '#28303D'; $gray = '#39414D'; $green = '#D1E4DD'; $blue = '#D1DFE4'; $purple = '#D1D1E4'; $red = '#E4D1D1'; $orange = '#E4DAD1'; $yellow = '#EEEADD'; $white = '#FFFFFF'; add_theme_support( 'editor-color-palette', array( array( 'name' => esc_html__( 'Black', 'twentytwentyone' ), 'slug' => 'black', 'color' => $black, ), array( 'name' => esc_html__( 'Dark gray', 'twentytwentyone' ), 'slug' => 'dark-gray', 'color' => $dark_gray, ), array( 'name' => esc_html__( 'Gray', 'twentytwentyone' ), 'slug' => 'gray', 'color' => $gray, ), array( 'name' => esc_html__( 'Green', 'twentytwentyone' ), 'slug' => 'green', 'color' => $green, ), array( 'name' => esc_html__( 'Blue', 'twentytwentyone' ), 'slug' => 'blue', 'color' => $blue, ), array( 'name' => esc_html__( 'Purple', 'twentytwentyone' ), 'slug' => 'purple', 'color' => $purple, ), array( 'name' => esc_html__( 'Red', 'twentytwentyone' ), 'slug' => 'red', 'color' => $red, ), array( 'name' => esc_html__( 'Orange', 'twentytwentyone' ), 'slug' => 'orange', 'color' => $orange, ), array( 'name' => esc_html__( 'Yellow', 'twentytwentyone' ), 'slug' => 'yellow', 'color' => $yellow, ), array( 'name' => esc_html__( 'White', 'twentytwentyone' ), 'slug' => 'white', 'color' => $white, ), ) ); add_theme_support( 'editor-gradient-presets', array( array( 'name' => esc_html__( 'Purple to yellow', 'twentytwentyone' ), 'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $yellow . ' 100%)', 'slug' => 'purple-to-yellow', ), array( 'name' => esc_html__( 'Yellow to purple', 'twentytwentyone' ), 'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $purple . ' 100%)', 'slug' => 'yellow-to-purple', ), array( 'name' => esc_html__( 'Green to yellow', 'twentytwentyone' ), 'gradient' => 'linear-gradient(160deg, ' . $green . ' 0%, ' . $yellow . ' 100%)', 'slug' => 'green-to-yellow', ), array( 'name' => esc_html__( 'Yellow to green', 'twentytwentyone' ), 'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $green . ' 100%)', 'slug' => 'yellow-to-green', ), array( 'name' => esc_html__( 'Red to yellow', 'twentytwentyone' ), 'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $yellow . ' 100%)', 'slug' => 'red-to-yellow', ), array( 'name' => esc_html__( 'Yellow to red', 'twentytwentyone' ), 'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $red . ' 100%)', 'slug' => 'yellow-to-red', ), array( 'name' => esc_html__( 'Purple to red', 'twentytwentyone' ), 'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $red . ' 100%)', 'slug' => 'purple-to-red', ), array( 'name' => esc_html__( 'Red to purple', 'twentytwentyone' ), 'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $purple . ' 100%)', 'slug' => 'red-to-purple', ), ) ); /* * Adds starter content to highlight the theme on fresh sites. * This is done conditionally to avoid loading the starter content on every * page load, as it is a one-off operation only needed once in the customizer. */ if ( is_customize_preview() ) { require get_template_directory() . '/inc/starter-content.php'; add_theme_support( 'starter-content', twenty_twenty_one_get_starter_content() ); } // Add support for responsive embedded content. add_theme_support( 'responsive-embeds' ); // Add support for custom line height controls. add_theme_support( 'custom-line-height' ); // Add support for experimental link color control. add_theme_support( 'experimental-link-color' ); // Add support for experimental cover block spacing. add_theme_support( 'custom-spacing' ); // Add support for custom units. // This was removed in WordPress 5.6 but is still required to properly support WP 5.5. add_theme_support( 'custom-units' ); // Remove feed icon link from legacy RSS widget. add_filter( 'rss_widget_feed_link', '__return_false' ); } } add_action( 'after_setup_theme', 'twenty_twenty_one_setup' ); /** * Register widget area. * * @since Twenty Twenty-One 1.0 * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar * * @return void */ function twenty_twenty_one_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Footer', 'twentytwentyone' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here to appear in your footer.', 'twentytwentyone' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'twenty_twenty_one_widgets_init' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @since Twenty Twenty-One 1.0 * * @global int $content_width Content width. * * @return void */ function twenty_twenty_one_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters( 'twenty_twenty_one_content_width', 750 ); } add_action( 'after_setup_theme', 'twenty_twenty_one_content_width', 0 ); /** * Enqueue scripts and styles. * * @since Twenty Twenty-One 1.0 * * @return void */ function twenty_twenty_one_scripts() { // Note, the is_IE global variable is defined by WordPress and is used // to detect if the current browser is internet explorer. global $is_IE, $wp_scripts; if ( $is_IE ) { // If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables. wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get( 'Version' ) ); } else { // If not IE, use the standard stylesheet. wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) ); } // RTL styles. wp_style_add_data( 'twenty-twenty-one-style', 'rtl', 'replace' ); // Print styles. wp_enqueue_style( 'twenty-twenty-one-print-style', get_template_directory_uri() . '/assets/css/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' ); // Threaded comment reply styles. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } // Register the IE11 polyfill file. wp_register_script( 'twenty-twenty-one-ie11-polyfills-asset', get_template_directory_uri() . '/assets/js/polyfills.js', array(), wp_get_theme()->get( 'Version' ), true ); // Register the IE11 polyfill loader. wp_register_script( 'twenty-twenty-one-ie11-polyfills', null, array(), wp_get_theme()->get( 'Version' ), true ); wp_add_inline_script( 'twenty-twenty-one-ie11-polyfills', wp_get_script_polyfill( $wp_scripts, array( 'Element.prototype.matches && Element.prototype.closest && window.NodeList && NodeList.prototype.forEach' => 'twenty-twenty-one-ie11-polyfills-asset', ) ) ); // Main navigation scripts. if ( has_nav_menu( 'primary' ) ) { wp_enqueue_script( 'twenty-twenty-one-primary-navigation-script', get_template_directory_uri() . '/assets/js/primary-navigation.js', array( 'twenty-twenty-one-ie11-polyfills' ), wp_get_theme()->get( 'Version' ), true ); } // Responsive embeds script. wp_enqueue_script( 'twenty-twenty-one-responsive-embeds-script', get_template_directory_uri() . '/assets/js/responsive-embeds.js', array( 'twenty-twenty-one-ie11-polyfills' ), wp_get_theme()->get( 'Version' ), true ); } add_action( 'wp_enqueue_scripts', 'twenty_twenty_one_scripts' ); /** * Enqueue block editor script. * * @since Twenty Twenty-One 1.0 * * @return void */ function twentytwentyone_block_editor_script() { wp_enqueue_script( 'twentytwentyone-editor', get_theme_file_uri( '/assets/js/editor.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), true ); } add_action( 'enqueue_block_editor_assets', 'twentytwentyone_block_editor_script' ); /** * Fix skip link focus in IE11. * * This does not enqueue the script because it is tiny and because it is only for IE11, * thus it does not warrant having an entire dedicated blocking script being loaded. * * @since Twenty Twenty-One 1.0 * * @link https://git.io/vWdr2 */ function twenty_twenty_one_skip_link_focus_fix() { // If SCRIPT_DEBUG is defined and true, print the unminified file. if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo '<script>'; include get_template_directory() . '/assets/js/skip-link-focus-fix.js'; echo '</script>'; } else { // The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`. ?> <script> /(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); </script> <?php } } add_action( 'wp_print_footer_scripts', 'twenty_twenty_one_skip_link_focus_fix' ); /** * Enqueue non-latin language styles. * * @since Twenty Twenty-One 1.0 * * @return void */ function twenty_twenty_one_non_latin_languages() { $custom_css = twenty_twenty_one_get_non_latin_css( 'front-end' ); if ( $custom_css ) { wp_add_inline_style( 'twenty-twenty-one-style', $custom_css ); } } add_action( 'wp_enqueue_scripts', 'twenty_twenty_one_non_latin_languages' ); // SVG Icons class. require get_template_directory() . '/classes/class-twenty-twenty-one-svg-icons.php'; // Custom color classes. require get_template_directory() . '/classes/class-twenty-twenty-one-custom-colors.php'; new Twenty_Twenty_One_Custom_Colors(); // Enhance the theme by hooking into WordPress. require get_template_directory() . '/inc/template-functions.php'; // Menu functions and filters. require get_template_directory() . '/inc/menu-functions.php'; // Custom template tags for the theme. require get_template_directory() . '/inc/template-tags.php'; // Customizer additions. require get_template_directory() . '/classes/class-twenty-twenty-one-customize.php'; new Twenty_Twenty_One_Customize(); // Block Patterns. require get_template_directory() . '/inc/block-patterns.php'; // Block Styles. require get_template_directory() . '/inc/block-styles.php'; // Dark Mode. require_once get_template_directory() . '/classes/class-twenty-twenty-one-dark-mode.php'; new Twenty_Twenty_One_Dark_Mode(); /** * Enqueue scripts for the customizer preview. * * @since Twenty Twenty-One 1.0 * * @return void */ function twentytwentyone_customize_preview_init() { wp_enqueue_script( 'twentytwentyone-customize-helpers', get_theme_file_uri( '/assets/js/customize-helpers.js' ), array(), wp_get_theme()->get( 'Version' ), true ); wp_enqueue_script( 'twentytwentyone-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview', 'customize-selective-refresh', 'jquery', 'twentytwentyone-customize-helpers' ), wp_get_theme()->get( 'Version' ), true ); } add_action( 'customize_preview_init', 'twentytwentyone_customize_preview_init' ); /** * Enqueue scripts for the customizer. * * @since Twenty Twenty-One 1.0 * * @return void */ function twentytwentyone_customize_controls_enqueue_scripts() { wp_enqueue_script( 'twentytwentyone-customize-helpers', get_theme_file_uri( '/assets/js/customize-helpers.js' ), array(), wp_get_theme()->get( 'Version' ), true ); } add_action( 'customize_controls_enqueue_scripts', 'twentytwentyone_customize_controls_enqueue_scripts' ); /** * Calculate classes for the main <html> element. * * @since Twenty Twenty-One 1.0 * * @return void */ function twentytwentyone_the_html_classes() { /** * Filters the classes for the main <html> element. * * @since Twenty Twenty-One 1.0 * * @param string The list of classes. Default empty string. */ $classes = apply_filters( 'twentytwentyone_html_classes', '' ); if ( ! $classes ) { return; } echo 'class="' . esc_attr( $classes ) . '"'; } /** * Add "is-IE" class to body if the user is on Internet Explorer. * * @since Twenty Twenty-One 1.0 * * @return void */ function twentytwentyone_add_ie_class() { ?> <script> if ( -1 !== navigator.userAgent.indexOf( 'MSIE' ) || -1 !== navigator.appVersion.indexOf( 'Trident/' ) ) { document.body.classList.add( 'is-IE' ); } </script> <?php } add_action( 'wp_footer', 'twentytwentyone_add_ie_class' );
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0 |
proxy
|
phpinfo
|
Settings