芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/cepali.edu.mx/wp-content/themes/twentytwentyfour/assets/functions.php
'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
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`. ?> __( '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 '
' . __( 'Skip to the content', 'twentytwenty' ) . '
'; } 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' => '
', 'after_title' => '
', 'before_widget' => '
', 'after_widget' => '
', ); // 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_edi