layers_apply_customizer_styles

The Layers layers apply customizer styles function.

Description

layers_apply_customizer_styles(); 

Usage

  1. if ( !function_exists( 'layers_apply_customizer_styles' ) ) { 
  2. require_once '/core/helpers/template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = layers_apply_customizer_styles(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/core/helpers/template.php  
  1. function layers_apply_customizer_styles() { 
  2.  
  3. /** 
  4. * Setup the colors to use below 
  5. */ 
  6. $main_color = layers_get_theme_mod( 'site-accent-color' , TRUE ); 
  7. $header_color = layers_get_theme_mod( 'header-background-color', FALSE ); 
  8. $header_color_no_default = layers_get_theme_mod( 'header-background-color', TRUE ); 
  9. $footer_color = layers_get_theme_mod( 'footer-background-color', FALSE ); 
  10.  
  11. /** 
  12. * Header Colors 
  13. */ 
  14.  
  15. $bg_opacity = 1; 
  16.  
  17. // Apply the BG Color 
  18. if( '' != $header_color ) { 
  19. layers_inline_styles( '.header-site, .header-site.header-sticky', 'css', array( 
  20. 'css' => 'background-color: rgba(' . implode( ', ' , layers_hex2rgb( $header_color ) ) . ', ' . $bg_opacity . '); ' 
  21. )); 
  22.  
  23. // Add Invert if the color isnot light 
  24. if ( 'dark' == layers_is_light_or_dark( $header_color ) ) { 
  25.  
  26. /** 
  27. * General Colors 
  28. */ 
  29.  
  30. if( '' != $header_color ) { 
  31. // Title Container 
  32. layers_inline_styles( '.title-container', 'background', array( 'background' => array( 'color' => $header_color ) ) ); 
  33. if ( 'dark' == layers_is_light_or_dark( $header_color ) ) { 
  34.  
  35. if( '' != $main_color ) { 
  36. // Buttons 
  37. layers_inline_button_styles( '', 'button', array( 
  38. 'selectors' => array( 
  39. 'input[type="button"]', 'input[type="submit"]', 'button', '.button', '.form-submit input[type="submit"]',  
  40. // Inverts 
  41. '.invert input[type="button"]', '.invert input[type="submit"]', '.invert button', '.invert .button', '.invert .form-submit input[type="submit"]',  
  42. ),  
  43. 'button' => array( 
  44. 'background-color' => $main_color,  
  45. )); 
  46.  
  47. // Content - Links 
  48. 'selectors' => array( '.copy a:not(.button)', '.story a:not(.button)' ),  
  49. 'css' => array( 
  50. 'color' => $main_color,  
  51. 'border-bottom-color' => $main_color,  
  52. ),  
  53. )); 
  54. 'selectors' => array( '.copy a:not(.button):hover', '.story a:not(.button):hover' ),  
  55. 'css' => array( 
  56. 'color' => layers_too_light_then_dark( $main_color ),  
  57. 'border-bottom-color' => layers_too_light_then_dark( $main_color ),  
  58. ),  
  59. )); 
  60.  
  61. // Debugging: 
  62. global $wp_customize; 
  63. if ( $wp_customize && ( (bool) layers_get_theme_mod( 'dev-switch-button-css-testing' ) ) ) { 
  64. echo '<pre style="font-size:11px;">'; 
  65. echo 'RE: Buttons - This should not happen if Layers Pro is active!'; 
  66. echo '</pre>'; 
  67.  
  68. /** 
  69. * Footer Colors. 
  70. */ 
  71.  
  72. if( '' != $footer_color ) { 
  73.  
  74. // Apply the BG Color 
  75. layers_inline_styles( '.footer-site', 'background', array( 
  76. 'background' => array( 
  77. 'color' => $footer_color,  
  78. ),  
  79. )); 
  80.  
  81. // Add Invert if the color isdark 
  82. if ( 'dark' == layers_is_light_or_dark( $footer_color ) ) { 
  83.