[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentyfifteen/inc/ -> customizer.php (source)

   1  <?php
   2  /**
   3   * Twenty Fifteen Customizer functionality
   4   *
   5   * @package WordPress
   6   * @subpackage Twenty_Fifteen
   7   * @since Twenty Fifteen 1.0
   8   */
   9  
  10  /**
  11   * Add postMessage support for site title and description for the Customizer.
  12   *
  13   * @since Twenty Fifteen 1.0
  14   *
  15   * @param WP_Customize_Manager $wp_customize Customizer object.
  16   */
  17  function twentyfifteen_customize_register( $wp_customize ) {
  18      $color_scheme = twentyfifteen_get_color_scheme();
  19  
  20      $wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
  21      $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
  22  
  23      if ( isset( $wp_customize->selective_refresh ) ) {
  24          $wp_customize->selective_refresh->add_partial(
  25              'blogname',
  26              array(
  27                  'selector'            => '.site-title a',
  28                  'container_inclusive' => false,
  29                  'render_callback'     => 'twentyfifteen_customize_partial_blogname',
  30              )
  31          );
  32          $wp_customize->selective_refresh->add_partial(
  33              'blogdescription',
  34              array(
  35                  'selector'            => '.site-description',
  36                  'container_inclusive' => false,
  37                  'render_callback'     => 'twentyfifteen_customize_partial_blogdescription',
  38              )
  39          );
  40      }
  41  
  42      // Add color scheme setting and control.
  43      $wp_customize->add_setting(
  44          'color_scheme',
  45          array(
  46              'default'           => 'default',
  47              'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme',
  48              'transport'         => 'postMessage',
  49          )
  50      );
  51  
  52      $wp_customize->add_control(
  53          'color_scheme',
  54          array(
  55              'label'    => __( 'Base Color Scheme', 'twentyfifteen' ),
  56              'section'  => 'colors',
  57              'type'     => 'select',
  58              'choices'  => twentyfifteen_get_color_scheme_choices(),
  59              'priority' => 1,
  60          )
  61      );
  62  
  63      // Add custom header and sidebar text color setting and control.
  64      $wp_customize->add_setting(
  65          'sidebar_textcolor',
  66          array(
  67              'default'           => $color_scheme[4],
  68              'sanitize_callback' => 'sanitize_hex_color',
  69              'transport'         => 'postMessage',
  70          )
  71      );
  72  
  73      $wp_customize->add_control(
  74          new WP_Customize_Color_Control(
  75              $wp_customize,
  76              'sidebar_textcolor',
  77              array(
  78                  'label'       => __( 'Header and Sidebar Text Color', 'twentyfifteen' ),
  79                  'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),
  80                  'section'     => 'colors',
  81              )
  82          )
  83      );
  84  
  85      // Remove the core header textcolor control, as it shares the sidebar text color.
  86      $wp_customize->remove_control( 'header_textcolor' );
  87  
  88      // Add custom header and sidebar background color setting and control.
  89      $wp_customize->add_setting(
  90          'header_background_color',
  91          array(
  92              'default'           => $color_scheme[1],
  93              'sanitize_callback' => 'sanitize_hex_color',
  94              'transport'         => 'postMessage',
  95          )
  96      );
  97  
  98      $wp_customize->add_control(
  99          new WP_Customize_Color_Control(
 100              $wp_customize,
 101              'header_background_color',
 102              array(
 103                  'label'       => __( 'Header and Sidebar Background Color', 'twentyfifteen' ),
 104                  'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),
 105                  'section'     => 'colors',
 106              )
 107          )
 108      );
 109  
 110      // Add an additional description to the header image section.
 111      $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' );
 112  }
 113  add_action( 'customize_register', 'twentyfifteen_customize_register', 11 );
 114  
 115  /**
 116   * Render the site title for the selective refresh partial.
 117   *
 118   * @since Twenty Fifteen 1.5
 119   * @see twentyfifteen_customize_register()
 120   *
 121   * @return void
 122   */
 123  function twentyfifteen_customize_partial_blogname() {
 124      bloginfo( 'name' );
 125  }
 126  
 127  /**
 128   * Render the site tagline for the selective refresh partial.
 129   *
 130   * @since Twenty Fifteen 1.5
 131   * @see twentyfifteen_customize_register()
 132   *
 133   * @return void
 134   */
 135  function twentyfifteen_customize_partial_blogdescription() {
 136      bloginfo( 'description' );
 137  }
 138  
 139  /**
 140   * Register color schemes for Twenty Fifteen.
 141   *
 142   * Can be filtered with {@see 'twentyfifteen_color_schemes'}.
 143   *
 144   * The order of colors in a colors array:
 145   * 1. Main Background Color.
 146   * 2. Sidebar Background Color.
 147   * 3. Box Background Color.
 148   * 4. Main Text and Link Color.
 149   * 5. Sidebar Text and Link Color.
 150   * 6. Meta Box Background Color.
 151   *
 152   * @since Twenty Fifteen 1.0
 153   *
 154   * @return array An associative array of color scheme options.
 155   */
 156  function twentyfifteen_get_color_schemes() {
 157      /**
 158       * Filter the color schemes registered for use with Twenty Fifteen.
 159       *
 160       * The default schemes include 'default', 'dark', 'yellow', 'pink', 'purple', and 'blue'.
 161       *
 162       * @since Twenty Fifteen 1.0
 163       *
 164       * @param array $schemes {
 165       *     Associative array of color schemes data.
 166       *
 167       *     @type array $slug {
 168       *         Associative array of information for setting up the color scheme.
 169       *
 170       *         @type string $label  Color scheme label.
 171       *         @type array  $colors HEX codes for default colors prepended with a hash symbol ('#').
 172       *                              Colors are defined in the following order: Main background, sidebar
 173       *                              background, box background, main text and link, sidebar text and link,
 174       *                              meta box background.
 175       *     }
 176       * }
 177       */
 178      return apply_filters(
 179          'twentyfifteen_color_schemes',
 180          array(
 181              'default' => array(
 182                  'label'  => __( 'Default', 'twentyfifteen' ),
 183                  'colors' => array(
 184                      '#f1f1f1',
 185                      '#ffffff',
 186                      '#ffffff',
 187                      '#333333',
 188                      '#333333',
 189                      '#f7f7f7',
 190                  ),
 191              ),
 192              'dark'    => array(
 193                  'label'  => __( 'Dark', 'twentyfifteen' ),
 194                  'colors' => array(
 195                      '#111111',
 196                      '#202020',
 197                      '#202020',
 198                      '#bebebe',
 199                      '#bebebe',
 200                      '#1b1b1b',
 201                  ),
 202              ),
 203              'yellow'  => array(
 204                  'label'  => __( 'Yellow', 'twentyfifteen' ),
 205                  'colors' => array(
 206                      '#f4ca16',
 207                      '#ffdf00',
 208                      '#ffffff',
 209                      '#111111',
 210                      '#111111',
 211                      '#f1f1f1',
 212                  ),
 213              ),
 214              'pink'    => array(
 215                  'label'  => __( 'Pink', 'twentyfifteen' ),
 216                  'colors' => array(
 217                      '#ffe5d1',
 218                      '#e53b51',
 219                      '#ffffff',
 220                      '#352712',
 221                      '#ffffff',
 222                      '#f1f1f1',
 223                  ),
 224              ),
 225              'purple'  => array(
 226                  'label'  => __( 'Purple', 'twentyfifteen' ),
 227                  'colors' => array(
 228                      '#674970',
 229                      '#2e2256',
 230                      '#ffffff',
 231                      '#2e2256',
 232                      '#ffffff',
 233                      '#f1f1f1',
 234                  ),
 235              ),
 236              'blue'    => array(
 237                  'label'  => __( 'Blue', 'twentyfifteen' ),
 238                  'colors' => array(
 239                      '#e9f2f9',
 240                      '#55c3dc',
 241                      '#ffffff',
 242                      '#22313f',
 243                      '#ffffff',
 244                      '#f1f1f1',
 245                  ),
 246              ),
 247          )
 248      );
 249  }
 250  
 251  if ( ! function_exists( 'twentyfifteen_get_color_scheme' ) ) :
 252      /**
 253       * Get the current Twenty Fifteen color scheme.
 254       *
 255       * @since Twenty Fifteen 1.0
 256       *
 257       * @return array An associative array of either the current or default color scheme hex values.
 258       */
 259  	function twentyfifteen_get_color_scheme() {
 260          $color_scheme_option = get_theme_mod( 'color_scheme', 'default' );
 261          $color_schemes       = twentyfifteen_get_color_schemes();
 262  
 263          if ( array_key_exists( $color_scheme_option, $color_schemes ) ) {
 264              return $color_schemes[ $color_scheme_option ]['colors'];
 265          }
 266  
 267          return $color_schemes['default']['colors'];
 268      }
 269  endif; // twentyfifteen_get_color_scheme
 270  
 271  if ( ! function_exists( 'twentyfifteen_get_color_scheme_choices' ) ) :
 272      /**
 273       * Returns an array of color scheme choices registered for Twenty Fifteen.
 274       *
 275       * @since Twenty Fifteen 1.0
 276       *
 277       * @return array Array of color schemes.
 278       */
 279  	function twentyfifteen_get_color_scheme_choices() {
 280          $color_schemes                = twentyfifteen_get_color_schemes();
 281          $color_scheme_control_options = array();
 282  
 283          foreach ( $color_schemes as $color_scheme => $value ) {
 284              $color_scheme_control_options[ $color_scheme ] = $value['label'];
 285          }
 286  
 287          return $color_scheme_control_options;
 288      }
 289  endif; // twentyfifteen_get_color_scheme_choices
 290  
 291  if ( ! function_exists( 'twentyfifteen_sanitize_color_scheme' ) ) :
 292      /**
 293       * Sanitization callback for color schemes.
 294       *
 295       * @since Twenty Fifteen 1.0
 296       *
 297       * @param string $value Color scheme name value.
 298       * @return string Color scheme name.
 299       */
 300  	function twentyfifteen_sanitize_color_scheme( $value ) {
 301          $color_schemes = twentyfifteen_get_color_scheme_choices();
 302  
 303          if ( ! array_key_exists( $value, $color_schemes ) ) {
 304              $value = 'default';
 305          }
 306  
 307          return $value;
 308      }
 309  endif; // twentyfifteen_sanitize_color_scheme
 310  
 311  /**
 312   * Enqueues front-end CSS for color scheme.
 313   *
 314   * @since Twenty Fifteen 1.0
 315   *
 316   * @see wp_add_inline_style()
 317   */
 318  function twentyfifteen_color_scheme_css() {
 319      $color_scheme_option = get_theme_mod( 'color_scheme', 'default' );
 320  
 321      // Don't do anything if the default color scheme is selected.
 322      if ( 'default' === $color_scheme_option ) {
 323          return;
 324      }
 325  
 326      $color_scheme = twentyfifteen_get_color_scheme();
 327  
 328      // Convert main and sidebar text hex color to rgba.
 329      $color_textcolor_rgb         = twentyfifteen_hex2rgb( $color_scheme[3] );
 330      $color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[4] );
 331      $colors                      = array(
 332          'background_color'            => $color_scheme[0],
 333          'header_background_color'     => $color_scheme[1],
 334          'box_background_color'        => $color_scheme[2],
 335          'textcolor'                   => $color_scheme[3],
 336          'secondary_textcolor'         => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb ),
 337          'border_color'                => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb ),
 338          'border_focus_color'          => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb ),
 339          'sidebar_textcolor'           => $color_scheme[4],
 340          'sidebar_border_color'        => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb ),
 341          'sidebar_border_focus_color'  => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb ),
 342          'secondary_sidebar_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb ),
 343          'meta_box_background_color'   => $color_scheme[5],
 344      );
 345  
 346      $color_scheme_css = twentyfifteen_get_color_scheme_css( $colors );
 347  
 348      wp_add_inline_style( 'twentyfifteen-style', $color_scheme_css );
 349  }
 350  add_action( 'wp_enqueue_scripts', 'twentyfifteen_color_scheme_css' );
 351  
 352  /**
 353   * Binds JS listener to make Customizer color_scheme control.
 354   *
 355   * Passes color scheme data as colorScheme global.
 356   *
 357   * @since Twenty Fifteen 1.0
 358   */
 359  function twentyfifteen_customize_control_js() {
 360      wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', true );
 361      wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() );
 362  }
 363  add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' );
 364  
 365  /**
 366   * Binds JS handlers to make the Customizer preview reload changes asynchronously.
 367   *
 368   * @since Twenty Fifteen 1.0
 369   */
 370  function twentyfifteen_customize_preview_js() {
 371      wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true );
 372  }
 373  add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' );
 374  
 375  /**
 376   * Returns CSS for the color schemes.
 377   *
 378   * @since Twenty Fifteen 1.0
 379   *
 380   * @param array $colors Color scheme colors.
 381   * @return string Color scheme CSS.
 382   */
 383  function twentyfifteen_get_color_scheme_css( $colors ) {
 384      $colors = wp_parse_args(
 385          $colors,
 386          array(
 387              'background_color'            => '',
 388              'header_background_color'     => '',
 389              'box_background_color'        => '',
 390              'textcolor'                   => '',
 391              'secondary_textcolor'         => '',
 392              'border_color'                => '',
 393              'border_focus_color'          => '',
 394              'sidebar_textcolor'           => '',
 395              'sidebar_border_color'        => '',
 396              'sidebar_border_focus_color'  => '',
 397              'secondary_sidebar_textcolor' => '',
 398              'meta_box_background_color'   => '',
 399          )
 400      );
 401  
 402      $css = <<<CSS
 403      /* Color Scheme */
 404  
 405      /* Background Color */
 406      body {
 407          background-color: {$colors['background_color']};
 408      }
 409  
 410      /* Sidebar Background Color */
 411      body:before,
 412      .site-header {
 413          background-color: {$colors['header_background_color']};
 414      }
 415  
 416      /* Box Background Color */
 417      .post-navigation,
 418      .pagination,
 419      .secondary,
 420      .site-footer,
 421      .hentry,
 422      .page-header,
 423      .page-content,
 424      .comments-area,
 425      .widecolumn {
 426          background-color: {$colors['box_background_color']};
 427      }
 428  
 429      /* Box Background Color */
 430      button,
 431      input[type="button"],
 432      input[type="reset"],
 433      input[type="submit"],
 434      .pagination .prev,
 435      .pagination .next,
 436      .widget_calendar tbody a,
 437      .widget_calendar tbody a:hover,
 438      .widget_calendar tbody a:focus,
 439      .page-links a,
 440      .page-links a:hover,
 441      .page-links a:focus,
 442      .sticky-post {
 443          color: {$colors['box_background_color']};
 444      }
 445  
 446      /* Main Text Color */
 447      button,
 448      input[type="button"],
 449      input[type="reset"],
 450      input[type="submit"],
 451      .pagination .prev,
 452      .pagination .next,
 453      .widget_calendar tbody a,
 454      .page-links a,
 455      .sticky-post {
 456          background-color: {$colors['textcolor']};
 457      }
 458  
 459      /* Main Text Color */
 460      body,
 461      blockquote cite,
 462      blockquote small,
 463      a,
 464      .dropdown-toggle:after,
 465      .image-navigation a:hover,
 466      .image-navigation a:focus,
 467      .comment-navigation a:hover,
 468      .comment-navigation a:focus,
 469      .widget-title,
 470      .entry-footer a:hover,
 471      .entry-footer a:focus,
 472      .comment-metadata a:hover,
 473      .comment-metadata a:focus,
 474      .pingback .edit-link a:hover,
 475      .pingback .edit-link a:focus,
 476      .comment-list .reply a:hover,
 477      .comment-list .reply a:focus,
 478      .site-info a:hover,
 479      .site-info a:focus {
 480          color: {$colors['textcolor']};
 481      }
 482  
 483      /* Main Text Color */
 484      .entry-content a,
 485      .entry-summary a,
 486      .page-content a,
 487      .comment-content a,
 488      .pingback .comment-body > a,
 489      .author-description a,
 490      .taxonomy-description a,
 491      .textwidget a,
 492      .entry-footer a:hover,
 493      .comment-metadata a:hover,
 494      .pingback .edit-link a:hover,
 495      .comment-list .reply a:hover,
 496      .site-info a:hover {
 497          border-color: {$colors['textcolor']};
 498      }
 499  
 500      /* Secondary Text Color */
 501      button:hover,
 502      button:focus,
 503      input[type="button"]:hover,
 504      input[type="button"]:focus,
 505      input[type="reset"]:hover,
 506      input[type="reset"]:focus,
 507      input[type="submit"]:hover,
 508      input[type="submit"]:focus,
 509      .pagination .prev:hover,
 510      .pagination .prev:focus,
 511      .pagination .next:hover,
 512      .pagination .next:focus,
 513      .widget_calendar tbody a:hover,
 514      .widget_calendar tbody a:focus,
 515      .page-links a:hover,
 516      .page-links a:focus {
 517          background-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
 518          background-color: {$colors['secondary_textcolor']};
 519      }
 520  
 521      /* Secondary Text Color */
 522      blockquote,
 523      a:hover,
 524      a:focus,
 525      .main-navigation .menu-item-description,
 526      .post-navigation .meta-nav,
 527      .post-navigation a:hover .post-title,
 528      .post-navigation a:focus .post-title,
 529      .image-navigation,
 530      .image-navigation a,
 531      .comment-navigation,
 532      .comment-navigation a,
 533      .widget,
 534      .author-heading,
 535      .entry-footer,
 536      .entry-footer a,
 537      .taxonomy-description,
 538      .page-links > .page-links-title,
 539      .entry-caption,
 540      .comment-author,
 541      .comment-metadata,
 542      .comment-metadata a,
 543      .pingback .edit-link,
 544      .pingback .edit-link a,
 545      .post-password-form label,
 546      .comment-form label,
 547      .comment-notes,
 548      .comment-awaiting-moderation,
 549      .logged-in-as,
 550      .form-allowed-tags,
 551      .no-comments,
 552      .site-info,
 553      .site-info a,
 554      .wp-caption-text,
 555      .gallery-caption,
 556      .comment-list .reply a,
 557      .widecolumn label,
 558      .widecolumn .mu_register label {
 559          color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
 560          color: {$colors['secondary_textcolor']};
 561      }
 562  
 563      /* Secondary Text Color */
 564      blockquote,
 565      .logged-in-as a:hover,
 566      .comment-author a:hover {
 567          border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
 568          border-color: {$colors['secondary_textcolor']};
 569      }
 570  
 571      /* Border Color */
 572      hr,
 573      .dropdown-toggle:hover,
 574      .dropdown-toggle:focus {
 575          background-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
 576          background-color: {$colors['border_color']};
 577      }
 578  
 579      /* Border Color */
 580      pre,
 581      abbr[title],
 582      table,
 583      th,
 584      td,
 585      input,
 586      textarea,
 587      .main-navigation ul,
 588      .main-navigation li,
 589      .post-navigation,
 590      .post-navigation div + div,
 591      .pagination,
 592      .comment-navigation,
 593      .widget li,
 594      .widget_categories .children,
 595      .widget_nav_menu .sub-menu,
 596      .widget_pages .children,
 597      .site-header,
 598      .site-footer,
 599      .hentry + .hentry,
 600      .author-info,
 601      .entry-content .page-links a,
 602      .page-links > span,
 603      .page-header,
 604      .comments-area,
 605      .comment-list + .comment-respond,
 606      .comment-list article,
 607      .comment-list .pingback,
 608      .comment-list .trackback,
 609      .comment-list .reply a,
 610      .no-comments {
 611          border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
 612          border-color: {$colors['border_color']};
 613      }
 614  
 615      /* Border Focus Color */
 616      a:focus,
 617      button:focus,
 618      input:focus {
 619          outline-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
 620          outline-color: {$colors['border_focus_color']};
 621      }
 622  
 623      input:focus,
 624      textarea:focus {
 625          border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
 626          border-color: {$colors['border_focus_color']};
 627      }
 628  
 629      /* Sidebar Link Color */
 630      .secondary-toggle:before {
 631          color: {$colors['sidebar_textcolor']};
 632      }
 633  
 634      .site-title a,
 635      .site-description {
 636          color: {$colors['sidebar_textcolor']};
 637      }
 638  
 639      /* Sidebar Text Color */
 640      .site-title a:hover,
 641      .site-title a:focus {
 642          color: {$colors['secondary_sidebar_textcolor']};
 643      }
 644  
 645      /* Sidebar Border Color */
 646      .secondary-toggle {
 647          border-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
 648          border-color: {$colors['sidebar_border_color']};
 649      }
 650  
 651      /* Sidebar Border Focus Color */
 652      .secondary-toggle:hover,
 653      .secondary-toggle:focus {
 654          border-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
 655          border-color: {$colors['sidebar_border_focus_color']};
 656      }
 657  
 658      .site-title a {
 659          outline-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
 660          outline-color: {$colors['sidebar_border_focus_color']};
 661      }
 662  
 663      /* Meta Background Color */
 664      .entry-footer {
 665          background-color: {$colors['meta_box_background_color']};
 666      }
 667  
 668      @media screen and (min-width: 38.75em) {
 669          /* Main Text Color */
 670          .page-header {
 671              border-color: {$colors['textcolor']};
 672          }
 673      }
 674  
 675      @media screen and (min-width: 59.6875em) {
 676          /* Make sure its transparent on desktop */
 677          .site-header,
 678          .secondary {
 679              background-color: transparent;
 680          }
 681  
 682          /* Sidebar Background Color */
 683          .widget button,
 684          .widget input[type="button"],
 685          .widget input[type="reset"],
 686          .widget input[type="submit"],
 687          .widget_calendar tbody a,
 688          .widget_calendar tbody a:hover,
 689          .widget_calendar tbody a:focus {
 690              color: {$colors['header_background_color']};
 691          }
 692  
 693          /* Sidebar Link Color */
 694          .secondary a,
 695          .dropdown-toggle:after,
 696          .widget-title,
 697          .widget blockquote cite,
 698          .widget blockquote small {
 699              color: {$colors['sidebar_textcolor']};
 700          }
 701  
 702          .widget button,
 703          .widget input[type="button"],
 704          .widget input[type="reset"],
 705          .widget input[type="submit"],
 706          .widget_calendar tbody a {
 707              background-color: {$colors['sidebar_textcolor']};
 708          }
 709  
 710          .textwidget a {
 711              border-color: {$colors['sidebar_textcolor']};
 712          }
 713  
 714          /* Sidebar Text Color */
 715          .secondary a:hover,
 716          .secondary a:focus,
 717          .main-navigation .menu-item-description,
 718          .widget,
 719          .widget blockquote,
 720          .widget .wp-caption-text,
 721          .widget .gallery-caption {
 722              color: {$colors['secondary_sidebar_textcolor']};
 723          }
 724  
 725          .widget button:hover,
 726          .widget button:focus,
 727          .widget input[type="button"]:hover,
 728          .widget input[type="button"]:focus,
 729          .widget input[type="reset"]:hover,
 730          .widget input[type="reset"]:focus,
 731          .widget input[type="submit"]:hover,
 732          .widget input[type="submit"]:focus,
 733          .widget_calendar tbody a:hover,
 734          .widget_calendar tbody a:focus {
 735              background-color: {$colors['secondary_sidebar_textcolor']};
 736          }
 737  
 738          .widget blockquote {
 739              border-color: {$colors['secondary_sidebar_textcolor']};
 740          }
 741  
 742          /* Sidebar Border Color */
 743          .main-navigation ul,
 744          .main-navigation li,
 745          .widget input,
 746          .widget textarea,
 747          .widget table,
 748          .widget th,
 749          .widget td,
 750          .widget pre,
 751          .widget li,
 752          .widget_categories .children,
 753          .widget_nav_menu .sub-menu,
 754          .widget_pages .children,
 755          .widget abbr[title] {
 756              border-color: {$colors['sidebar_border_color']};
 757          }
 758  
 759          .dropdown-toggle:hover,
 760          .dropdown-toggle:focus,
 761          .widget hr {
 762              background-color: {$colors['sidebar_border_color']};
 763          }
 764  
 765          .widget input:focus,
 766          .widget textarea:focus {
 767              border-color: {$colors['sidebar_border_focus_color']};
 768          }
 769  
 770          .sidebar a:focus,
 771          .dropdown-toggle:focus {
 772              outline-color: {$colors['sidebar_border_focus_color']};
 773          }
 774      }
 775  CSS;
 776  
 777      return $css;
 778  }
 779  
 780  /**
 781   * Output an Underscore template for generating CSS for the color scheme.
 782   *
 783   * The template generates the css dynamically for instant display in the Customizer
 784   * preview.
 785   *
 786   * @since Twenty Fifteen 1.0
 787   */
 788  function twentyfifteen_color_scheme_css_template() {
 789      $colors = array(
 790          'background_color'            => '{{ data.background_color }}',
 791          'header_background_color'     => '{{ data.header_background_color }}',
 792          'box_background_color'        => '{{ data.box_background_color }}',
 793          'textcolor'                   => '{{ data.textcolor }}',
 794          'secondary_textcolor'         => '{{ data.secondary_textcolor }}',
 795          'border_color'                => '{{ data.border_color }}',
 796          'border_focus_color'          => '{{ data.border_focus_color }}',
 797          'sidebar_textcolor'           => '{{ data.sidebar_textcolor }}',
 798          'sidebar_border_color'        => '{{ data.sidebar_border_color }}',
 799          'sidebar_border_focus_color'  => '{{ data.sidebar_border_focus_color }}',
 800          'secondary_sidebar_textcolor' => '{{ data.secondary_sidebar_textcolor }}',
 801          'meta_box_background_color'   => '{{ data.meta_box_background_color }}',
 802      );
 803      ?>
 804      <script type="text/html" id="tmpl-twentyfifteen-color-scheme">
 805          <?php echo twentyfifteen_get_color_scheme_css( $colors ); ?>
 806      </script>
 807      <?php
 808  }
 809  add_action( 'customize_controls_print_footer_scripts', 'twentyfifteen_color_scheme_css_template' );


Generated: Sun Sep 15 01:00:03 2019 Cross-referenced by PHPXref 0.7.1