Changeset 46445 for trunk/src/wp-content/themes/twentytwenty/functions.php
- Timestamp:
- 10/08/2019 07:05:53 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentytwenty/functions.php
r46357 r46445 20 20 * WP Body Open 21 21 * Register Sidebars 22 * Enqueue Block editor assets23 * Classic Editor Style22 * Enqueue block editor assets 23 * Enqueue classic editor styles 24 24 * Block editor settings 25 25 */ … … 61 61 set_post_thumbnail_size( 1200, 9999 ); 62 62 63 // Add custom image size s.63 // Add custom image size used in Cover Template. 64 64 add_image_size( 'twentytwenty-fullscreen', 1980, 9999 ); 65 65 … … 175 175 function twentytwenty_register_styles() { 176 176 177 $theme_version = wp_get_theme()->get( 'Version' ); 178 $css_dependencies = array(); 179 180 /** 181 * Filter to load, unload Font Awesome CSS 182 * 183 * By default, only load the Font Awesome fonts if the social menu is in use or 184 * using filter Font Awesome css be loaded 185 * 186 * @since 1.0.0 187 * 188 * @param bool Whether to load font awesome, Default false. 189 */ 190 $load_font_awesome = apply_filters( 'twentytwenty_load_font_awesome', has_nav_menu( 'social' ) ); 191 192 if ( $load_font_awesome ) { 193 wp_register_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.css', false, '5.10.2', 'all' ); 194 $css_dependencies[] = 'font-awesome'; 195 } 196 197 wp_enqueue_style( 'twentytwenty-style', get_template_directory_uri() . '/style.css', $css_dependencies, $theme_version ); 177 $theme_version = wp_get_theme()->get( 'Version' ); 178 179 wp_enqueue_style( 'twentytwenty-style', get_stylesheet_uri(), array(), $theme_version ); 198 180 wp_style_add_data( 'twentytwenty-style', 'rtl', 'replace' ); 199 181 … … 248 230 * 249 231 * @param string $html The HTML output from get_custom_logo (core function). 232 * 233 * @return string $html 250 234 */ 251 235 function twentytwenty_get_custom_logo( $html ) { … … 303 287 */ 304 288 function twentytwenty_skip_link() { 305 echo '<a class="skip-link screen-reader-text" href="#site-content">' . __( 'Skip to the content', 'twentytwenty' ) . '</a>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- core trusts translations289 echo '<a class="skip-link screen-reader-text" href="#site-content">' . __( 'Skip to the content', 'twentytwenty' ) . '</a>'; 306 290 } 307 291 … … 387 371 388 372 /** 389 * Output Customizer Settings in the Classic Editor.373 * Output Customizer settings in the classic editor. 390 374 * Adds styles to the head of the TinyMCE iframe. Kudos to @Otto42 for the original solution. 391 375 * 392 376 * @param array $mce_init TinyMCE styles. 377 * 378 * @return array $mce_init TinyMCE styles. 393 379 */ 394 380 function twentytwenty_add_classic_editor_customizer_styles( $mce_init ) { … … 417 403 $editor_color_palette = array( 418 404 array( 419 'name' => esc_html__( 'Accent Color', 'twentytwenty' ),405 'name' => __( 'Accent Color', 'twentytwenty' ), 420 406 'slug' => 'accent', 421 407 'color' => twentytwenty_get_color_for_area( 'content', 'accent' ), 422 408 ), 423 409 array( 424 'name' => esc_html__( 'Secondary', 'twentytwenty' ), 410 'name' => __( 'Primary', 'twentytwenty' ), 411 'slug' => 'primary', 412 'color' => twentytwenty_get_color_for_area( 'content', 'text' ), 413 ), 414 array( 415 'name' => __( 'Secondary', 'twentytwenty' ), 425 416 'slug' => 'secondary', 426 417 'color' => twentytwenty_get_color_for_area( 'content', 'secondary' ), 427 418 ), 428 419 array( 429 'name' => esc_html__( 'Subtle Background', 'twentytwenty' ),420 'name' => __( 'Subtle Background', 'twentytwenty' ), 430 421 'slug' => 'subtle-background', 431 422 'color' => twentytwenty_get_color_for_area( 'content', 'borders' ), … … 450 441 } 451 442 452 // GutenbergFont Sizes.443 // Block Editor Font Sizes. 453 444 add_theme_support( 454 445 'editor-font-sizes', 455 446 array( 456 447 array( 457 'name' => _x( 'Small', 'Name of the small font size in Gutenberg', 'twentytwenty' ),458 'shortName' => _x( 'S', 'Short name of the small font size in the Gutenbergeditor.', 'twentytwenty' ),459 'size' => 1 6,448 'name' => _x( 'Small', 'Name of the small font size in the block editor', 'twentytwenty' ), 449 'shortName' => _x( 'S', 'Short name of the small font size in the block editor.', 'twentytwenty' ), 450 'size' => 18, 460 451 'slug' => 'small', 461 452 ), 462 453 array( 463 'name' => _x( 'Regular', 'Name of the regular font size in Gutenberg', 'twentytwenty' ),464 'shortName' => _x( 'M', 'Short name of the regular font size in the Gutenbergeditor.', 'twentytwenty' ),465 'size' => 18,454 'name' => _x( 'Regular', 'Name of the regular font size in the block editor', 'twentytwenty' ), 455 'shortName' => _x( 'M', 'Short name of the regular font size in the block editor.', 'twentytwenty' ), 456 'size' => 21, 466 457 'slug' => 'regular', 467 458 ), 468 459 array( 469 'name' => _x( 'Large', 'Name of the large font size in Gutenberg', 'twentytwenty' ),470 'shortName' => _x( 'L', 'Short name of the large font size in the Gutenbergeditor.', 'twentytwenty' ),460 'name' => _x( 'Large', 'Name of the large font size in the block editor', 'twentytwenty' ), 461 'shortName' => _x( 'L', 'Short name of the large font size in the block editor.', 'twentytwenty' ), 471 462 'size' => 24, 472 463 'slug' => 'large', 473 464 ), 474 465 array( 475 'name' => _x( 'Larger', 'Name of the larger font size in Gutenberg', 'twentytwenty' ),476 'shortName' => _x( 'XL', 'Short name of the larger font size in the Gutenbergeditor.', 'twentytwenty' ),466 'name' => _x( 'Larger', 'Name of the larger font size in the block editor', 'twentytwenty' ), 467 'shortName' => _x( 'XL', 'Short name of the larger font size in the block editor.', 'twentytwenty' ), 477 468 'size' => 32, 478 469 'slug' => 'larger', … … 499 490 '<a href="%1$s" class="more-link faux-button">%2$s <span class="screen-reader-text">"%3$s"</span></a>', 500 491 esc_url( get_permalink( get_the_ID() ) ), 501 esc_html__( 'Continue reading', 'twentytwenty' ),502 get_the_title( get_the_ID() )492 __( 'Continue reading', 'twentytwenty' ), 493 esc_html( get_the_title( get_the_ID() ) ) 503 494 ); 504 495 } … … 514 505 function twentytwenty_customize_controls_enqueue_scripts() { 515 506 $theme_version = wp_get_theme()->get( 'Version' ); 507 508 // Add main customizer js file. 509 wp_enqueue_script( 'twentytwenty-customize', get_template_directory_uri() . '/assets/js/customize.js', array( 'jquery' ), $theme_version, false ); 516 510 517 511 // Add script for color calculations. … … 623 617 'content' => array( 624 618 'accent' => array( 625 'color' => array( '.color-accent', '.color-accent-hover:hover', '.color-accent-hover:focus', '.has-accent-color', '.has-drop-cap:not(:focus):first-letter', '.wp-block-button.is-style-outline', 'a' ), 626 'border-color' => array( 'blockquote', '.border-color-accent', '.border-color-accent-hover:hover', '.border-color-accent-hover:focus' ), 627 'background' => array( 'button:not(.toggle)', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file__button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]' ), 628 'background-color' => array( '.bg-accent', '.bg-accent-hover:hover', '.bg-accent-hover:focus', '.has-accent-background-color', '.comment-reply-link' ), 629 'fill' => array( '.fill-children-accent', '.fill-children-accent *' ), 619 'color' => array( '.color-accent', '.color-accent-hover:hover', '.color-accent-hover:focus', '.has-accent-color', '.has-drop-cap:not(:focus):first-letter', '.wp-block-button.is-style-outline', 'a' ), 620 'border-color' => array( 'blockquote', '.border-color-accent', '.border-color-accent-hover:hover', '.border-color-accent-hover:focus' ), 621 'background' => array( 'button:not(.toggle)', '.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', '.has-accent-background-color', '.comment-reply-link' ), 622 'fill' => array( '.fill-children-accent', '.fill-children-accent *' ), 630 623 ), 631 624 'background' => array( 632 625 'color' => array( 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-button__link:active', '.wp-block-button__link:focus', '.wp-block-button__link:visited', '.wp-block-button__link:hover', '.wp-block-file__button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]', '.comment-reply-link' ), 633 'background' => array( ),626 'background' => array( '.has-background-background-color' ), 634 627 ), 635 628 'text' => array( 636 'color' => array( 'body', '.entry-title a' ), 629 'color' => array( 'body', '.entry-title a', '.has-primary-color' ), 630 'background' => array( '.has-primary-background-color' ), 637 631 ), 638 632 'secondary' => array( 639 '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' ), 633 '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', '.has-secondary-color' ), 634 'background' => array( '.has-secondary-background-color' ), 640 635 ), 641 636 'borders' => array( 642 637 'border-color' => array( 'pre', 'fieldset', 'input', 'textarea', 'table', 'table *', 'hr' ), 643 'background' => array( 'caption', 'code', 'code', 'kbd', 'samp', '.wp-block-table.is-style-stripes tbody tr:nth-child(odd)' ),638 'background' => array( 'caption', 'code', 'code', 'kbd', 'samp', '.wp-block-table.is-style-stripes tbody tr:nth-child(odd)', '.has-subtle-background-background-color' ), 644 639 'border-bottom-color' => array( '.wp-block-table.is-style-stripes' ), 645 640 'border-top-color' => array( '.wp-block-latest-posts.is-grid li' ), 641 'color' => array( '.has-subtle-background-color' ), 646 642 ), 647 643 ), … … 652 648 ), 653 649 'background' => array( 654 'color' => array( '.social-icons a', '.overlay-header .header-inner', ' .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"]' ),650 'color' => array( '.social-icons a', '.overlay-header .header-inner', '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"]' ), 655 651 'background' => 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' ), 656 652 ),
Note: See TracChangeset
for help on using the changeset viewer.