Beispiel #1
0
 /**
  * Build the CSS rules for the custom layout options.
  *
  * @since  1.5.0.
  *
  * @return void
  */
 function ttfmake_css_layout()
 {
     /**
      * Header & Footer
      */
     $header_hide_padding_bottom = absint(get_theme_mod('header-hide-padding-bottom', ttfmake_get_default('header-hide-padding-bottom')));
     $footer_hide_padding_top = absint(get_theme_mod('footer-hide-padding-top', ttfmake_get_default('footer-hide-padding-top')));
     if ($header_hide_padding_bottom || $footer_hide_padding_top) {
         $declarations = array();
         if ($header_hide_padding_bottom) {
             $declarations['padding-top'] = 0;
         }
         if ($footer_hide_padding_top) {
             $declarations['padding-bottom'] = 0;
         }
         ttfmake_get_css()->add(array('selectors' => array('.site-content'), 'declarations' => $declarations));
     }
     /**
      * Featured image alignment
      */
     $views = array('blog', 'archive', 'search', 'post', 'page');
     foreach ($views as $view) {
         $key = 'layout-' . $view . '-featured-images-alignment';
         $default = ttfmake_get_default($key);
         $alignment = ttfmake_sanitize_choice(get_theme_mod($key, $default), $key);
         if ($alignment !== $default) {
             ttfmake_get_css()->add(array('selectors' => array('.' . $view . ' .entry-header .entry-thumbnail'), 'declarations' => array('text-align' => $alignment)));
         }
     }
 }
Beispiel #2
0
 /**
  * Add frontend CSS rules for Banner sections based on certain section options.
  *
  * @since 1.4.5
  *
  * @param array    $data    The banner's section data.
  * @param int      $id      The banner's section ID.
  *
  * @return void
  */
 function ttfmake_builder_banner_css($data, $id)
 {
     $prefix = 'builder-section-';
     $id = sanitize_title_with_dashes($data['id']);
     /**
      * This filter is documented in inc/builder/core/save.php
      */
     $section_id = apply_filters('make_section_html_id', $prefix . $id, $data);
     $responsive = isset($data['responsive']) ? $data['responsive'] : 'balanced';
     $slider_height = absint($data['height']);
     if (0 === $slider_height) {
         $slider_height = 600;
     }
     $slider_ratio = $slider_height / 960 * 100;
     if ('aspect' === $responsive) {
         ttfmake_get_css()->add(array('selectors' => array('#' . esc_attr($section_id) . ' .builder-banner-slide'), 'declarations' => array('padding-bottom' => $slider_ratio . '%')));
     } else {
         ttfmake_get_css()->add(array('selectors' => array('#' . esc_attr($section_id) . ' .builder-banner-slide'), 'declarations' => array('padding-bottom' => $slider_height . 'px')));
         ttfmake_get_css()->add(array('selectors' => array('#' . esc_attr($section_id) . ' .builder-banner-slide'), 'declarations' => array('padding-bottom' => $slider_ratio . '%'), 'media' => 'screen and (min-width: 600px) and (max-width: 960px)'));
     }
 }
Beispiel #3
0
 /**
  * Build the CSS rules for the custom fonts
  *
  * @since  1.0.0
  *
  * @return void
  */
 function ttfmake_css_fonts()
 {
     // Get relative sizes
     $percent = ttfmake_font_get_relative_sizes();
     /**
      * Body
      */
     $element = 'body';
     $selectors = array('body', '.font-body');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     // Links
     $link_font_weight = ttfmake_sanitize_choice(get_theme_mod('font-weight-body-link', ttfmake_get_default('font-weight-body-link')), 'font-weight-body-link');
     if ($link_font_weight !== ttfmake_get_default('font-weight-body-link')) {
         ttfmake_get_css()->add(array('selectors' => array('a'), 'declarations' => array('font-weight' => $link_font_weight)));
     }
     // Comments
     if (isset($declarations['font-size-px'])) {
         ttfmake_get_css()->add(array('selectors' => array('#comments'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($declarations['font-size-px'], $percent['comments']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($declarations['font-size-px'], $percent['comments'])) . 'rem')));
         // Comment date
         ttfmake_get_css()->add(array('selectors' => array('.comment-date'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($declarations['font-size-px'], $percent['comment-date']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($declarations['font-size-px'], $percent['comment-date'])) . 'rem')));
     }
     /**
      * H1
      */
     $element = 'h1';
     $selectors = array('h1:not(.site-title)', 'h1:not(.site-title) a', '.font-header');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('h1:not(.site-title) a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * H2
      */
     $element = 'h2';
     $selectors = array('h2', 'h2 a');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('h2 a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     // Post title with two sidebars
     if (isset($declarations['font-size-px'])) {
         ttfmake_get_css()->add(array('selectors' => array('.has-left-sidebar.has-right-sidebar .entry-title'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($declarations['font-size-px'], $percent['post-title']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($declarations['font-size-px'], $percent['post-title'])) . 'rem'), 'media' => 'screen and (min-width: 800px)'));
     }
     /**
      * H3
      */
     $element = 'h3';
     $selectors = array('h3', 'h3 a', '.builder-text-content .widget-title');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('h3 a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * H4
      */
     $element = 'h4';
     $selectors = array('h4', 'h4 a');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('h4 a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * H5
      */
     $element = 'h5';
     $selectors = array('h5', 'h5 a');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('h5 a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * H6
      */
     $element = 'h6';
     $selectors = array('h6', 'h6 a');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('h6 a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * Site Title
      */
     $element = 'site-title';
     $selectors = array('.site-title', '.site-title a', '.font-site-title');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.site-title a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * Site Tagline
      */
     $element = 'site-tagline';
     $selectors = array('.site-description', '.site-description a', '.font-site-tagline');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.site-description a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * Menu Item
      */
     $menu_items_customized = false;
     $element = 'nav';
     $selectors = array('.site-navigation .menu li a', '.font-nav');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
         $menu_items_customized = true;
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.site-navigation .menu li a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     // Arrow size and grandchild arrow size and position
     if (isset($declarations['font-size-px'])) {
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .page_item_has_children a:after', '.site-navigation .menu .menu-item-has-children a:after'), 'declarations' => array('top' => '-' . ttfmake_get_relative_font_size($declarations['font-size-px'], 10) . 'px', 'font-size-px' => ttfmake_get_relative_font_size($declarations['font-size-px'], 72) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($declarations['font-size-px'], 72)) . 'rem'), 'media' => 'screen and (min-width: 800px)'));
     }
     /**
      * Sub-Menu Item
      */
     $submenu_items_customized = false;
     $element = 'subnav';
     $selectors = array('.site-navigation .menu .sub-menu li a', '.site-navigation .menu .children li a');
     $declarations = ttfmake_parse_font_properties($element, $menu_items_customized);
     $simplify_mobile = (bool) get_theme_mod('font-' . $element . '-mobile', ttfmake_get_default('font-' . $element . '-mobile'));
     $media = 'all';
     if (true === $simplify_mobile) {
         $media = 'screen and (min-width: 800px)';
     }
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations, 'media' => $media));
         $submenu_items_customized = true;
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.site-navigation .menu .sub-menu li a', '.site-navigation .menu .children li a'));
     if (!empty($link_rule)) {
         $link_rule['media'] = $media;
         ttfmake_get_css()->add($link_rule);
     }
     // Grandchild arrow size
     if (isset($declarations['font-size-px'])) {
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .children .page_item_has_children a:after', '.site-navigation .menu .sub-menu .menu-item-has-children a:after'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($declarations['font-size-px'], 72) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($declarations['font-size-px'], 72)) . 'rem'), 'media' => 'screen and (min-width: 800px)'));
     }
     /**
      * Current Item
      */
     $current_item_weight = ttfmake_sanitize_choice(get_theme_mod('font-weight-nav-current-item', ttfmake_get_default('font-weight-nav-current-item')), 'font-weight-nav-current-item');
     if ($current_item_weight !== ttfmake_get_default('font-weight-nav-current-item') || true === $menu_items_customized || true === $submenu_items_customized) {
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu li.current_page_item > a', '.site-navigation .menu .children li.current_page_item > a', '.site-navigation .menu li.current-menu-item > a', '.site-navigation .menu .sub-menu li.current-menu-item > a'), 'declarations' => array('font-weight' => $current_item_weight)));
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu li.current_page_item > a', '.site-navigation .menu .children li.current_page_item > a', '.site-navigation .menu li.current_page_ancestor > a', '.site-navigation .menu li.current-menu-item > a', '.site-navigation .menu .sub-menu li.current-menu-item > a', '.site-navigation .menu li.current-menu-ancestor > a'), 'declarations' => array('font-weight' => $current_item_weight), 'media' => 'screen and (min-width: 800px)'));
     }
     /**
      * Header Bar Text
      */
     $element = 'header-bar-text';
     $selectors = array('.header-bar', '.header-text', '.header-bar .search-form input', '.header-bar .menu a');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.header-bar a', '.header-text a', '.header-bar .menu a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     // Header Bar Icons
     $header_icon_size = absint(get_theme_mod('font-size-header-bar-icon', ttfmake_get_default('font-size-header-bar-icon')));
     if ($header_icon_size !== ttfmake_get_default('font-size-header-bar-icon')) {
         ttfmake_get_css()->add(array('selectors' => array('.header-social-links li a'), 'declarations' => array('font-size-px' => $header_icon_size . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem($header_icon_size) . 'rem')));
         ttfmake_get_css()->add(array('selectors' => array('.header-social-links li a'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($header_icon_size, $percent['header-bar-icon']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($header_icon_size, $percent['header-bar-icon'])) . 'rem'), 'media' => 'screen and (min-width: 1100px)'));
     }
     /**
      * Sidebar Widget Title
      */
     $element = 'widget-title';
     $selectors = array('.sidebar .widget-title', '.sidebar .widgettitle', '.sidebar .widget-title a', '.sidebar .widgettitle a', '.font-widget-title');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.sidebar .widget-title a', '.sidebar .widgettitle a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * Sidebar Widget Body
      */
     $element = 'widget';
     $selectors = array('.sidebar .widget', '.font-widget');
     $force = get_theme_mod('font-family-body', ttfmake_get_default('font-family-body')) !== ttfmake_get_default('font-family-body');
     $declarations = ttfmake_parse_font_properties($element, $force);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.sidebar .widget a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * Footer Widget Title
      */
     $element = 'footer-widget-title';
     $selectors = array('.footer-widget-container .widget-title', '.footer-widget-container .widgettitle', '.footer-widget-container .widget-title a', '.footer-widget-container .widgettitle a');
     $declarations = ttfmake_parse_font_properties($element);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.footer-widget-container .widget-title a', '.footer-widget-container .widgettitle a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * Footer Widget Body
      */
     $element = 'footer-widget';
     $selectors = array('.footer-widget-container .widget');
     $force = get_theme_mod('font-family-body', ttfmake_get_default('font-family-body')) !== ttfmake_get_default('font-family-body');
     $declarations = ttfmake_parse_font_properties($element, $force);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.footer-widget-container .widget a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     /**
      * Footer Text
      */
     $element = 'footer-text';
     $selectors = array('.footer-text');
     $force = get_theme_mod('font-family-body', ttfmake_get_default('font-family-body')) !== ttfmake_get_default('font-family-body');
     $declarations = ttfmake_parse_font_properties($element, $force);
     if (!empty($declarations)) {
         ttfmake_get_css()->add(array('selectors' => $selectors, 'declarations' => $declarations));
     }
     $link_rule = ttfmake_parse_link_underline($element, array('.footer-text a'));
     if (!empty($link_rule)) {
         ttfmake_get_css()->add($link_rule);
     }
     // Footer Icons
     $footer_icon_size = absint(get_theme_mod('font-size-footer-icon', ttfmake_get_default('font-size-footer-icon')));
     if ($footer_icon_size !== ttfmake_get_default('font-size-footer-icon')) {
         ttfmake_get_css()->add(array('selectors' => array('.footer-social-links'), 'declarations' => array('font-size-px' => $footer_icon_size . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem($footer_icon_size) . 'rem')));
         ttfmake_get_css()->add(array('selectors' => array('.footer-social-links'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($footer_icon_size, $percent['footer-icon']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($footer_icon_size, $percent['footer-icon'])) . 'rem'), 'media' => 'screen and (min-width: 1100px)'));
     }
 }
Beispiel #4
0
 /**
  * Make sure theme option CSS is added to TinyMCE last, to override other styles.
  *
  * @since  1.0.0.
  *
  * @param  string    $stylesheets    List of stylesheets added to TinyMCE.
  * @return string                    Modified list of stylesheets.
  */
 function ttfmake_mce_css($stylesheets)
 {
     if (ttfmake_get_css()->build()) {
         $stylesheets .= ',' . add_query_arg('action', 'ttfmake-css', admin_url('admin-ajax.php'));
     }
     return $stylesheets;
 }
Beispiel #5
0
 /**
  * Print CSS in the head for the logo.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function print_logo_css()
 {
     /**
      * Filter the maximum allowable width for a custom logo.
      *
      * @since 1.0.0.
      *
      * @param string|int    $width    The maximum width, in pixels.
      */
     $size = apply_filters('ttfmake_custom_logo_max_width', '960');
     // Grab the logo information
     $info = $this->get_logo_information();
     // Both logo types are available
     if ($this->has_logo_by_type('logo-regular') && $this->has_logo_by_type('logo-retina')) {
         $final_dimensions = $this->adjust_dimensions($info['logo-regular']['width'], $info['logo-regular']['height'], $size, false);
         ttfmake_get_css()->add(array('selectors' => array('.custom-logo'), 'declarations' => array('background-image' => 'url("' . addcslashes(esc_url_raw($info['logo-regular']['image']), '"') . '")', 'width' => absint($final_dimensions['width']) . 'px')));
         ttfmake_get_css()->add(array('selectors' => array('.custom-logo a'), 'declarations' => array('padding-bottom' => (double) $final_dimensions['ratio'] . '%')));
         ttfmake_get_css()->add(array('selectors' => array('.custom-logo'), 'declarations' => array('background-image' => 'url("' . addcslashes(esc_url_raw($info['logo-retina']['image']), '"') . '")'), 'media' => '(-webkit-min-device-pixel-ratio: 1.3),(-o-min-device-pixel-ratio: 2.6/2),(min--moz-device-pixel-ratio: 1.3),(min-device-pixel-ratio: 1.3),(min-resolution: 1.3dppx)'));
     } else {
         if ($this->has_logo_by_type('logo-regular')) {
             $final_dimensions = $this->adjust_dimensions($info['logo-regular']['width'], $info['logo-regular']['height'], $size);
             ttfmake_get_css()->add(array('selectors' => array('.custom-logo'), 'declarations' => array('background-image' => 'url("' . addcslashes(esc_url_raw($info['logo-regular']['image']), '"') . '")', 'width' => absint($final_dimensions['width']) . 'px')));
             ttfmake_get_css()->add(array('selectors' => array('.custom-logo a'), 'declarations' => array('padding-bottom' => (double) $final_dimensions['ratio'] . '%')));
         } else {
             if ($this->has_logo_by_type('logo-retina')) {
                 $final_dimensions = $this->adjust_dimensions($info['logo-retina']['width'], $info['logo-retina']['height'], $size, true);
                 ttfmake_get_css()->add(array('selectors' => array('.custom-logo'), 'declarations' => array('background-image' => 'url("' . addcslashes(esc_url_raw($info['logo-retina']['image']), '"') . '")', 'width' => absint($final_dimensions['width']) . 'px')));
                 ttfmake_get_css()->add(array('selectors' => array('.custom-logo a'), 'declarations' => array('padding-bottom' => (double) $final_dimensions['ratio'] . '%')));
             }
         }
     }
 }
 /**
  * Append the editor styles to the section editors.
  *
  * Unfortunately, the `wp_editor()` function does not support a "content_css" argument. As a result, the stylesheet
  * for the "content_css" parameter needs to be added via a filter.
  *
  * @since  1.0.0.
  *
  * @param  array     $mce_init     The array of tinyMCE settings.
  * @param  string    $editor_id    The ID for the current editor.
  * @return array                   The modified settings.
  */
 function tiny_mce_before_init($mce_init, $editor_id)
 {
     // Only add stylesheet to a section editor
     if (false === strpos($editor_id, 'make')) {
         return $mce_init;
     }
     // Editor styles
     $editor_styles = array();
     if ('' !== ($google_request = ttfmake_get_google_font_uri())) {
         $editor_styles[] = $google_request;
     }
     $editor_styles[] = get_template_directory_uri() . '/css/font-awesome.css';
     $editor_styles[] = get_template_directory_uri() . '/css/editor-style.css';
     // Append in the customizer styles if available
     if (function_exists('ttfmake_get_css') && ttfmake_get_css()->build()) {
         $editor_styles[] = add_query_arg('action', 'ttfmake-css', admin_url('admin-ajax.php'));
     }
     // Create string of CSS files
     $content_css = implode(',', $editor_styles);
     // If there is already a stylesheet being added, append and do not override
     if (isset($mce_init['content_css'])) {
         $mce_init['content_css'] .= ',' . $content_css;
     } else {
         $mce_init['content_css'] = $content_css;
     }
     return $mce_init;
 }
Beispiel #7
0
/**
 * Build the CSS rules for the color scheme.
 *
 * @since 1.5.0.
 *
 * @return void
 */
function ttfmake_css_color()
{
    /**
     * Global
     */
    // Primary color
    $color_primary = maybe_hash_hex_color(get_theme_mod('color-primary', ttfmake_get_default('color-primary')));
    if ($color_primary !== ttfmake_get_default('color-primary')) {
        ttfmake_get_css()->add(array('selectors' => array('.color-primary-text', 'a', '.entry-author-byline a.vcard', '.entry-footer a:hover', '.comment-form .required', 'ul.ttfmake-list-dot li:before', 'ol.ttfmake-list-dot li:before', '.entry-comment-count a:hover', '.comment-count-icon a:hover'), 'declarations' => array('color' => $color_primary)));
        ttfmake_get_css()->add(array('selectors' => array('.color-primary-background', '.ttfmake-button.color-primary-background'), 'declarations' => array('background-color' => $color_primary)));
        ttfmake_get_css()->add(array('selectors' => array('.color-primary-border'), 'declarations' => array('border-color' => $color_primary)));
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation ul.menu ul a:hover', '.site-navigation ul.menu ul a:focus', '.site-navigation .menu ul ul a:hover', '.site-navigation .menu ul ul a:focus'), 'declarations' => array('background-color' => $color_primary), 'media' => 'screen and (min-width: 800px)'));
    }
    // Secondary color
    $color_secondary = maybe_hash_hex_color(get_theme_mod('color-secondary', ttfmake_get_default('color-secondary')));
    if ($color_secondary !== ttfmake_get_default('color-secondary')) {
        ttfmake_get_css()->add(array('selectors' => array('.color-secondary-text', '.builder-section-banner .cycle-pager', '.ttfmake-shortcode-slider .cycle-pager', '.builder-section-banner .cycle-prev:before', '.builder-section-banner .cycle-next:before', '.ttfmake-shortcode-slider .cycle-prev:before', '.ttfmake-shortcode-slider .cycle-next:before', '.ttfmake-shortcode-slider .cycle-caption'), 'declarations' => array('color' => $color_secondary)));
        ttfmake_get_css()->add(array('selectors' => array('.color-secondary-background', 'blockquote.ttfmake-testimonial', 'tt', 'kbd', 'pre', 'code', 'samp', 'var', 'textarea', 'input[type="date"]', 'input[type="datetime"]', 'input[type="datetime-local"]', 'input[type="email"]', 'input[type="month"]', 'input[type="number"]', 'input[type="password"]', 'input[type="search"]', 'input[type="tel"]', 'input[type="text"]', 'input[type="time"]', 'input[type="url"]', 'input[type="week"]', '.ttfmake-button.color-secondary-background', 'button.color-secondary-background', 'input[type="button"].color-secondary-background', 'input[type="reset"].color-secondary-background', 'input[type="submit"].color-secondary-background', '.sticky-post-label', '.widget_tag_cloud a'), 'declarations' => array('background-color' => $color_secondary)));
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .sub-menu', '.site-navigation .menu .children'), 'declarations' => array('background-color' => $color_secondary), 'media' => 'screen and (min-width: 800px)'));
        ttfmake_get_css()->add(array('selectors' => array('.color-secondary-border', 'table', 'table th', 'table td', '.header-layout-3 .site-navigation .menu'), 'declarations' => array('border-color' => $color_secondary)));
        ttfmake_get_css()->add(array('selectors' => array('hr', 'hr.ttfmake-line-dashed', 'hr.ttfmake-line-double', 'blockquote.ttfmake-testimonial:after'), 'declarations' => array('border-top-color' => $color_secondary)));
        ttfmake_get_css()->add(array('selectors' => array('.comment-body', '.post', '.widget li'), 'declarations' => array('border-bottom-color' => $color_secondary)));
    }
    // Text color
    $color_text = maybe_hash_hex_color(get_theme_mod('color-text', ttfmake_get_default('color-text')));
    if ($color_text !== ttfmake_get_default('color-text')) {
        ttfmake_get_css()->add(array('selectors' => array('.color-text', 'body', '.entry-date a', 'button', 'input', 'select', 'textarea', '[class*="navigation"] .nav-previous a', '[class*="navigation"] .nav-previous span', '[class*="navigation"] .nav-next a', '[class*="navigation"] .nav-next span'), 'declarations' => array('color' => $color_text)));
        // These placeholder selectors have to be isolated in individual rules.
        // See http://css-tricks.com/snippets/css/style-placeholder-text/#comment-96771
        ttfmake_get_css()->add(array('selectors' => array('::-webkit-input-placeholder'), 'declarations' => array('color' => $color_text)));
        ttfmake_get_css()->add(array('selectors' => array(':-moz-placeholder'), 'declarations' => array('color' => $color_text)));
        ttfmake_get_css()->add(array('selectors' => array('::-moz-placeholder'), 'declarations' => array('color' => $color_text)));
        ttfmake_get_css()->add(array('selectors' => array(':-ms-input-placeholder'), 'declarations' => array('color' => $color_text)));
    }
    // Detail color
    $color_detail = maybe_hash_hex_color(get_theme_mod('color-detail', ttfmake_get_default('color-detail')));
    if ($color_detail !== ttfmake_get_default('color-detail')) {
        ttfmake_get_css()->add(array('selectors' => array('.color-detail-text', '.builder-section-banner .cycle-pager .cycle-pager-active', '.ttfmake-shortcode-slider .cycle-pager .cycle-pager-active', '.entry-footer a', '.entry-footer .fa', '.post-categories li:after', '.post-tags li:after', '.comment-count-icon:before', '.entry-comment-count a', '.comment-count-icon a'), 'declarations' => array('color' => $color_detail)));
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .page_item_has_children a:after', '.site-navigation .menu-item-has-children a:after'), 'declarations' => array('color' => $color_detail), 'media' => 'screen and (min-width: 800px)'));
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .sub-menu a', '.site-navigation .menu .children a'), 'declarations' => array('border-bottom-color' => $color_detail), 'media' => 'screen and (min-width: 800px)'));
        ttfmake_get_css()->add(array('selectors' => array('.color-detail-background'), 'declarations' => array('background-color' => $color_detail)));
        ttfmake_get_css()->add(array('selectors' => array('.color-detail-border'), 'declarations' => array('border-color' => $color_detail)));
    }
    // Link Hover/Focus Color
    $color_primary_link = maybe_hash_hex_color(get_theme_mod('color-primary-link', ttfmake_get_default('color-primary-link')));
    if ($color_primary_link && $color_primary_link !== ttfmake_get_default('color-primary-link')) {
        ttfmake_get_css()->add(array('selectors' => array('a:hover', 'a:focus', '.entry-author-byline a.vcard:hover', '.entry-author-byline a.vcard:focus'), 'declarations' => array('color' => $color_primary_link)));
    }
    // Main background color
    $main_background_color = maybe_hash_hex_color(get_theme_mod('main-background-color', ttfmake_get_default('main-background-color')));
    $main_background_color_opacity = ttfmake_sanitize_float(get_theme_mod('main-background-color-opacity', ttfmake_get_default('main-background-color-opacity')));
    if ($main_background_color !== ttfmake_get_default('main-background-color') || $main_background_color_opacity !== (double) ttfmake_get_default('main-background-color-opacity')) {
        // Convert to RGBa
        $color_value = ttfmake_hex_to_rgb($main_background_color) . ', ' . $main_background_color_opacity;
        ttfmake_get_css()->add(array('selectors' => array('.site-content', 'body.mce-content-body'), 'declarations' => array('background-color' => 'rgba(' . $color_value . ')')));
    }
    /**
     * Header
     */
    // Header text color
    $header_text_color = maybe_hash_hex_color(get_theme_mod('header-text-color', ttfmake_get_default('header-text-color')));
    if ($header_text_color !== ttfmake_get_default('header-text-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-header', '.site-title', '.site-title a', '.site-navigation .menu li a'), 'declarations' => array('color' => $header_text_color)));
    }
    // Header background color
    $header_background_color = maybe_hash_hex_color(get_theme_mod('header-background-color', ttfmake_get_default('header-background-color')));
    $header_background_color_opacity = ttfmake_sanitize_float(get_theme_mod('header-background-color-opacity', ttfmake_get_default('header-background-color-opacity')));
    if ($header_background_color !== ttfmake_get_default('header-background-color') || $header_background_color_opacity !== (double) ttfmake_get_default('header-background-color-opacity')) {
        // Convert to RGBa
        $color_value = ttfmake_hex_to_rgb($header_background_color) . ', ' . $header_background_color_opacity;
        ttfmake_get_css()->add(array('selectors' => array('.site-header-main'), 'declarations' => array('background-color' => 'rgba(' . $color_value . ')')));
    }
    /**
     * Site Title & Tagline
     */
    // Site title
    $color_site_title = maybe_hash_hex_color(get_theme_mod('color-site-title', ttfmake_get_default('color-site-title')));
    if ($color_site_title && ($color_site_title !== ttfmake_get_default('color-site-title') || $header_text_color !== $color_site_title)) {
        ttfmake_get_css()->add(array('selectors' => array('.site-header .site-title', '.site-header .site-title a'), 'declarations' => array('color' => $color_site_title)));
    }
    // Tagline
    $color_tagline = maybe_hash_hex_color(get_theme_mod('color-site-tagline', ttfmake_get_default('color-site-tagline')));
    if ($color_tagline && ($color_tagline !== ttfmake_get_default('color-site-tagline') || $header_text_color !== $color_tagline)) {
        ttfmake_get_css()->add(array('selectors' => array('.site-header .site-description'), 'declarations' => array('color' => $color_tagline)));
    }
    /**
     * Main Menu
     */
    // Menu Item Text
    $color_nav_text = maybe_hash_hex_color(get_theme_mod('color-nav-text', ttfmake_get_default('color-nav-text')));
    if ($color_nav_text && $color_nav_text !== ttfmake_get_default('color-nav-text')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu li a'), 'declarations' => array('color' => $color_nav_text)));
    }
    // Menu Item Text hover
    $color_nav_text_hover = maybe_hash_hex_color(get_theme_mod('color-nav-text-hover', ttfmake_get_default('color-nav-text-hover')));
    if ($color_nav_text_hover && $color_nav_text_hover !== ttfmake_get_default('color-nav-text-hover')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu li a:hover', '.site-navigation .menu li a:focus'), 'declarations' => array('color' => $color_nav_text_hover)));
    }
    // Sub-Menu Item Text
    $color_subnav_text = maybe_hash_hex_color(get_theme_mod('color-subnav-text', ttfmake_get_default('color-subnav-text')));
    if ($color_subnav_text && $color_subnav_text !== ttfmake_get_default('color-subnav-text')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation ul.menu ul a', '.site-navigation ul.menu ul a', '.site-navigation .menu ul ul a', '.site-navigation .menu ul ul a'), 'declarations' => array('color' => $color_subnav_text), 'media' => 'screen and (min-width: 800px)'));
    }
    // Sub-Menu Item Text hover
    $color_subnav_text_hover = maybe_hash_hex_color(get_theme_mod('color-subnav-text-hover', ttfmake_get_default('color-subnav-text-hover')));
    if ($color_subnav_text_hover && $color_subnav_text_hover !== ttfmake_get_default('color-subnav-text-hover')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation ul.menu ul a:hover', '.site-navigation ul.menu ul a:focus', '.site-navigation .menu ul ul a:hover', '.site-navigation .menu ul ul a:focus'), 'declarations' => array('color' => $color_subnav_text_hover), 'media' => 'screen and (min-width: 800px)'));
    }
    // Sub-Menu Item Detail
    $color_subnav_detail = maybe_hash_hex_color(get_theme_mod('color-subnav-detail', ttfmake_get_default('color-subnav-detail')));
    if ($color_subnav_detail && $color_subnav_detail !== ttfmake_get_default('color-subnav-detail')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .page_item_has_children a:after', '.site-navigation .menu-item-has-children a:after'), 'declarations' => array('color' => $color_subnav_detail), 'media' => 'screen and (min-width: 800px)'));
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .sub-menu a', '.site-navigation .menu .children a'), 'declarations' => array('border-bottom-color' => $color_subnav_detail), 'media' => 'screen and (min-width: 800px)'));
    }
    // Sub-Menu Item Background
    $color_subnav_background = maybe_hash_hex_color(get_theme_mod('color-subnav-background', ttfmake_get_default('color-subnav-background')));
    $color_subnav_background_opacity = ttfmake_sanitize_float(get_theme_mod('color-subnav-background-opacity', ttfmake_get_default('color-subnav-background-opacity')));
    if ($color_subnav_background && ($color_subnav_background !== ttfmake_get_default('color-subnav-background') || $color_subnav_background_opacity !== ttfmake_get_default('color-subnav-background-opacity'))) {
        // Convert to RGBa
        $color_value = ttfmake_hex_to_rgb($color_subnav_background) . ', ' . $color_subnav_background_opacity;
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .sub-menu', '.site-navigation .menu .children'), 'declarations' => array('background-color' => 'rgba(' . $color_value . ')'), 'media' => 'screen and (min-width: 800px)'));
    }
    // Sub-Menu Item Background hover
    $color_subnav_background_hover = maybe_hash_hex_color(get_theme_mod('color-subnav-background-hover', ttfmake_get_default('color-subnav-background-hover')));
    $color_subnav_background_hover_opacity = ttfmake_sanitize_float(get_theme_mod('color-subnav-background-hover-opacity', ttfmake_get_default('color-subnav-background-hover-opacity')));
    if ($color_subnav_background_hover && ($color_subnav_background_hover !== ttfmake_get_default('color-subnav-background-hover') || $color_subnav_background_hover_opacity !== ttfmake_get_default('color-subnav-background-hover-opacity'))) {
        // Convert to RGBa
        $color_value = ttfmake_hex_to_rgb($color_subnav_background_hover) . ', ' . $color_subnav_background_hover_opacity;
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation ul.menu ul a:hover', '.site-navigation ul.menu ul a:focus', '.site-navigation .menu ul ul a:hover', '.site-navigation .menu ul ul a:focus'), 'declarations' => array('background-color' => 'rgba(' . $color_value . ')'), 'media' => 'screen and (min-width: 800px)'));
    }
    // Current Item Background
    $color_nav_current_item_background = maybe_hash_hex_color(get_theme_mod('color-nav-current-item-background', ttfmake_get_default('color-nav-current-item-background')));
    $color_nav_current_item_background_opacity = ttfmake_sanitize_float(get_theme_mod('color-nav-current-item-background-opacity', ttfmake_get_default('color-nav-current-item-background-opacity')));
    if ($color_nav_current_item_background && ($color_nav_current_item_background !== ttfmake_get_default('color-nav-current-item-background') || $color_nav_current_item_background_opacity !== ttfmake_get_default('color-nav-current-item-background-opacity'))) {
        // Convert to RGBa
        $color_value = ttfmake_hex_to_rgb($color_nav_current_item_background) . ', ' . $color_nav_current_item_background_opacity;
        ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu li.current_page_item', '.site-navigation .menu .children li.current_page_item', '.site-navigation .menu li.current_page_ancestor', '.site-navigation .menu li.current-menu-item', '.site-navigation .menu .sub-menu li.current-menu-item', '.site-navigation .menu li.current-menu-ancestor'), 'declarations' => array('background-color' => 'rgba(' . $color_value . ')'), 'media' => 'screen and (min-width: 800px)'));
    }
    /**
     * Header Bar
     */
    // Header Bar text color
    $header_bar_text_color = maybe_hash_hex_color(get_theme_mod('header-bar-text-color', ttfmake_get_default('header-bar-text-color')));
    if ($header_bar_text_color !== ttfmake_get_default('header-bar-text-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.header-bar', '.header-bar a', '.header-bar .menu li a'), 'declarations' => array('color' => $header_bar_text_color)));
    }
    // Header Bar link color
    $header_bar_link_color = maybe_hash_hex_color(get_theme_mod('header-bar-link-color', ttfmake_get_default('header-bar-link-color')));
    if ($header_bar_link_color && $header_bar_link_color !== ttfmake_get_default('header-bar-link-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.header-bar a', '.header-bar .menu li a', '.header-bar .social-links a'), 'declarations' => array('color' => $header_bar_link_color)));
    }
    // Header Bar link hover color
    $header_bar_link_hover_color = maybe_hash_hex_color(get_theme_mod('header-bar-link-hover-color', ttfmake_get_default('header-bar-link-hover-color')));
    if ($header_bar_link_hover_color && $header_bar_link_hover_color !== ttfmake_get_default('header-bar-link-hover-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.header-bar a:hover', '.header-bar a:focus', '.header-bar .menu li a:hover', '.header-bar .menu li a:focus'), 'declarations' => array('color' => $header_bar_link_hover_color)));
    }
    // Header Bar border color
    $header_bar_border_color = maybe_hash_hex_color(get_theme_mod('header-bar-border-color', ttfmake_get_default('header-bar-border-color')));
    if ($header_bar_border_color !== ttfmake_get_default('header-bar-border-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.header-bar', '.header-bar .search-form input', '.header-social-links li:first-of-type', '.header-social-links li a'), 'declarations' => array('border-color' => $header_bar_border_color)));
    }
    // Header Bar background color
    $header_bar_background_color = maybe_hash_hex_color(get_theme_mod('header-bar-background-color', ttfmake_get_default('header-bar-background-color')));
    $header_bar_background_color_opacity = ttfmake_sanitize_float(get_theme_mod('header-bar-background-color-opacity', ttfmake_get_default('header-bar-background-color-opacity')));
    if ($header_bar_background_color !== ttfmake_get_default('header-bar-background-color') || $header_bar_background_color_opacity !== (double) ttfmake_get_default('header-bar-background-color-opacity')) {
        // Convert to RGBa
        $color_value = ttfmake_hex_to_rgb($header_bar_background_color) . ', ' . $header_bar_background_color_opacity;
        ttfmake_get_css()->add(array('selectors' => array('.header-bar'), 'declarations' => array('background-color' => 'rgba(' . $color_value . ')')));
    }
    /**
     * Sidebars
     */
    // Sidebar widget title
    $color_widget_title = maybe_hash_hex_color(get_theme_mod('color-widget-title-text', ttfmake_get_default('color-widget-title-text')));
    if ($color_widget_title && $color_widget_title !== ttfmake_get_default('color-widget-title-text')) {
        ttfmake_get_css()->add(array('selectors' => array('.sidebar .widget-title', '.sidebar .widgettitle', '.sidebar .widget-title a', '.sidebar .widgettitle a'), 'declarations' => array('color' => $color_widget_title)));
    }
    // Sidebar widget body
    $color_widget_body = maybe_hash_hex_color(get_theme_mod('color-widget-text', ttfmake_get_default('color-widget-text')));
    if ($color_widget_body && $color_widget_body !== ttfmake_get_default('color-widget-text')) {
        ttfmake_get_css()->add(array('selectors' => array('.sidebar .widget'), 'declarations' => array('color' => $color_widget_body)));
    }
    // Sidebar link
    $color_widget_link = maybe_hash_hex_color(get_theme_mod('color-widget-link', ttfmake_get_default('color-widget-link')));
    if ($color_widget_link && $color_widget_link !== ttfmake_get_default('color-widget-link')) {
        ttfmake_get_css()->add(array('selectors' => array('.sidebar a'), 'declarations' => array('color' => $color_widget_link)));
    }
    // Sidebar link hover
    $color_widget_link_hover = maybe_hash_hex_color(get_theme_mod('color-widget-link-hover', ttfmake_get_default('color-widget-link-hover')));
    if ($color_widget_link_hover && $color_widget_link_hover !== ttfmake_get_default('color-widget-link-hover')) {
        ttfmake_get_css()->add(array('selectors' => array('.sidebar a:hover', '.sidebar a:focus'), 'declarations' => array('color' => $color_widget_link_hover)));
    }
    // Sidebar widget border
    $color_widget_border = maybe_hash_hex_color(get_theme_mod('color-widget-border', ttfmake_get_default('color-widget-border')));
    if ($color_widget_border && $color_widget_border !== ttfmake_get_default('color-widget-border')) {
        ttfmake_get_css()->add(array('selectors' => array('.sidebar table', '.sidebar table th', '.sidebar table td', '.sidebar .widget li'), 'declarations' => array('border-color' => $color_widget_border)));
    }
    /**
     * Footer section
     */
    // Footer text color
    $footer_text_color = maybe_hash_hex_color(get_theme_mod('footer-text-color', ttfmake_get_default('footer-text-color')));
    if ($footer_text_color !== ttfmake_get_default('footer-text-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-footer', '.site-footer .social-links a'), 'declarations' => array('color' => $footer_text_color)));
    }
    // Footer link color
    $footer_link_color = maybe_hash_hex_color(get_theme_mod('footer-link-color', ttfmake_get_default('footer-link-color')));
    if ($footer_link_color !== ttfmake_get_default('footer-link-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-footer a'), 'declarations' => array('color' => $footer_link_color)));
    }
    // Footer link hover color
    $footer_link_hover_color = maybe_hash_hex_color(get_theme_mod('footer-link-hover-color', ttfmake_get_default('footer-link-hover-color')));
    if ($footer_link_hover_color !== ttfmake_get_default('footer-link-hover-color') || $footer_link_color !== ttfmake_get_default('footer-link-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-footer a:hover', '.site-footer a:focus'), 'declarations' => array('color' => $footer_link_hover_color)));
    }
    // Footer border color
    $footer_border_color = maybe_hash_hex_color(get_theme_mod('footer-border-color', ttfmake_get_default('footer-border-color')));
    if ($footer_border_color !== ttfmake_get_default('footer-border-color')) {
        ttfmake_get_css()->add(array('selectors' => array('.site-footer *:not(select)'), 'declarations' => array('border-color' => $footer_border_color . ' !important')));
    }
    // Footer background color
    $footer_background_color = maybe_hash_hex_color(get_theme_mod('footer-background-color', ttfmake_get_default('footer-background-color')));
    $footer_background_color_opacity = ttfmake_sanitize_float(get_theme_mod('footer-background-color-opacity', ttfmake_get_default('footer-background-color-opacity')));
    if ($footer_background_color !== ttfmake_get_default('footer-background-color') || $footer_background_color_opacity !== (double) ttfmake_get_default('footer-background-color-opacity')) {
        // Convert to RGBa
        $color_value = ttfmake_hex_to_rgb($footer_background_color) . ', ' . $footer_background_color_opacity;
        ttfmake_get_css()->add(array('selectors' => array('.site-footer'), 'declarations' => array('background-color' => 'rgba(' . $color_value . ')')));
    }
}
 /**
  * Process user options to generate CSS needed to implement the choices.
  *
  * This function reads in the options from theme mods and determines whether a CSS rule is needed to implement an
  * option. CSS is only written for choices that are non-default in order to avoid adding unnecessary CSS. All options
  * are also filterable allowing for more precise control via a child theme or plugin.
  *
  * Note that all CSS for options is present in this function except for the CSS for fonts and the logo, which require
  * a lot more code to implement.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_css_add_rules()
 {
     /**
      * Background section
      */
     $site_background_image = get_theme_mod('background_image', ttfmake_get_default('background_image'));
     if (!empty($site_background_image)) {
         // Note that most site background options are handled by internal WordPress functions
         $site_background_size = ttfmake_sanitize_choice(get_theme_mod('background_size', ttfmake_get_default('background_size')), 'background-size');
         ttfmake_get_css()->add(array('selectors' => array('body'), 'declarations' => array('background-size' => $site_background_size)));
     }
     /**
      * Colors section
      */
     // Get and escape options
     $color_primary = maybe_hash_hex_color(get_theme_mod('color-primary', ttfmake_get_default('color-primary')));
     $color_secondary = maybe_hash_hex_color(get_theme_mod('color-secondary', ttfmake_get_default('color-secondary')));
     $color_text = maybe_hash_hex_color(get_theme_mod('color-text', ttfmake_get_default('color-text')));
     $color_detail = maybe_hash_hex_color(get_theme_mod('color-detail', ttfmake_get_default('color-detail')));
     // Primary color
     if ($color_primary !== ttfmake_get_default('color-primary')) {
         ttfmake_get_css()->add(array('selectors' => array('.color-primary-text', 'a', '.entry-author-byline a.vcard', '.entry-footer a:hover', '.comment-form .required', 'ul.ttfmake-list-dot li:before', 'ol.ttfmake-list-dot li:before', '.entry-comment-count a:hover', '.comment-count-icon a:hover'), 'declarations' => array('color' => $color_primary)));
         ttfmake_get_css()->add(array('selectors' => array('.color-primary-background', '.ttfmake-button.color-primary-background'), 'declarations' => array('background-color' => $color_primary)));
         ttfmake_get_css()->add(array('selectors' => array('.color-primary-border'), 'declarations' => array('border-color' => $color_primary)));
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation ul.menu ul a:hover', '.site-navigation ul.menu ul a:focus', '.site-navigation .menu ul ul a:hover', '.site-navigation .menu ul ul a:focus'), 'declarations' => array('background-color' => $color_primary), 'media' => 'screen and (min-width: 800px)'));
     }
     // Secondary color
     if ($color_secondary !== ttfmake_get_default('color-secondary')) {
         ttfmake_get_css()->add(array('selectors' => array('.color-secondary-text', '.builder-section-banner .cycle-pager', '.ttfmake-shortcode-slider .cycle-pager', '.builder-section-banner .cycle-prev:before', '.builder-section-banner .cycle-next:before', '.ttfmake-shortcode-slider .cycle-prev:before', '.ttfmake-shortcode-slider .cycle-next:before', '.ttfmake-shortcode-slider .cycle-caption'), 'declarations' => array('color' => $color_secondary)));
         ttfmake_get_css()->add(array('selectors' => array('.color-secondary-background', 'blockquote.ttfmake-testimonial', 'tt', 'kbd', 'pre', 'code', 'samp', 'var', 'textarea', 'input[type="date"]', 'input[type="datetime"]', 'input[type="datetime-local"]', 'input[type="email"]', 'input[type="month"]', 'input[type="number"]', 'input[type="password"]', 'input[type="search"]', 'input[type="tel"]', 'input[type="text"]', 'input[type="time"]', 'input[type="url"]', 'input[type="week"]', '.ttfmake-button.color-secondary-background', 'button.color-secondary-background', 'input[type="button"].color-secondary-background', 'input[type="reset"].color-secondary-background', 'input[type="submit"].color-secondary-background', '.sticky-post-label', '.widget_tag_cloud a'), 'declarations' => array('background-color' => $color_secondary)));
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .sub-menu', '.site-navigation .menu .children'), 'declarations' => array('background-color' => $color_secondary), 'media' => 'screen and (min-width: 800px)'));
         ttfmake_get_css()->add(array('selectors' => array('.color-secondary-border', 'table', 'table th', 'table td', '.header-layout-3 .site-navigation .menu'), 'declarations' => array('border-color' => $color_secondary)));
         ttfmake_get_css()->add(array('selectors' => array('hr', 'hr.ttfmake-line-dashed', 'hr.ttfmake-line-double', 'blockquote.ttfmake-testimonial:after'), 'declarations' => array('border-top-color' => $color_secondary)));
         ttfmake_get_css()->add(array('selectors' => array('.comment-body', '.post', '.widget li'), 'declarations' => array('border-bottom-color' => $color_secondary)));
     }
     // Text color
     if ($color_text !== ttfmake_get_default('color-text')) {
         ttfmake_get_css()->add(array('selectors' => array('.color-text', 'body', '.entry-date a', 'body', 'button', 'input', 'select', 'textarea', '[class*="navigation"] .nav-previous a', '[class*="navigation"] .nav-previous span', '[class*="navigation"] .nav-next a', '[class*="navigation"] .nav-next span'), 'declarations' => array('color' => $color_text)));
         // These placeholder selectors have to be isolated in individual rules.
         // See http://css-tricks.com/snippets/css/style-placeholder-text/#comment-96771
         ttfmake_get_css()->add(array('selectors' => array('::-webkit-input-placeholder'), 'declarations' => array('color' => $color_text)));
         ttfmake_get_css()->add(array('selectors' => array(':-moz-placeholder'), 'declarations' => array('color' => $color_text)));
         ttfmake_get_css()->add(array('selectors' => array('::-moz-placeholder'), 'declarations' => array('color' => $color_text)));
         ttfmake_get_css()->add(array('selectors' => array(':-ms-input-placeholder'), 'declarations' => array('color' => $color_text)));
     }
     // Detail color
     if ($color_detail !== ttfmake_get_default('color-detail')) {
         ttfmake_get_css()->add(array('selectors' => array('.color-detail-text', '.builder-section-banner .cycle-pager .cycle-pager-active', '.ttfmake-shortcode-slider .cycle-pager .cycle-pager-active', '.post-categories li:after', '.post-tags li:after', '.comment-count-icon:before', '.entry-comment-count a', '.comment-count-icon a'), 'declarations' => array('color' => $color_detail)));
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu-item-has-children a:after'), 'declarations' => array('color' => $color_detail), 'media' => 'screen and (min-width: 800px)'));
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .sub-menu a', '.site-navigation .menu .sub-menu a'), 'declarations' => array('border-bottom-color' => $color_detail), 'media' => 'screen and (min-width: 800px)'));
         ttfmake_get_css()->add(array('selectors' => array('.color-detail-background'), 'declarations' => array('background-color' => $color_detail)));
         ttfmake_get_css()->add(array('selectors' => array('.color-detail-border'), 'declarations' => array('border-color' => $color_detail)));
     }
     /**
      * Header section
      */
     // Get and escape options
     $header_text_color = maybe_hash_hex_color(get_theme_mod('header-text-color', ttfmake_get_default('header-text-color')));
     $header_background_color = maybe_hash_hex_color(get_theme_mod('header-background-color', ttfmake_get_default('header-background-color')));
     $header_background_image = get_theme_mod('header-background-image', ttfmake_get_default('header-background-image'));
     $header_bar_text_color = maybe_hash_hex_color(get_theme_mod('header-bar-text-color', ttfmake_get_default('header-bar-text-color')));
     $header_bar_border_color = maybe_hash_hex_color(get_theme_mod('header-bar-border-color', ttfmake_get_default('header-bar-border-color')));
     $header_bar_background_color = maybe_hash_hex_color(get_theme_mod('header-bar-background-color', ttfmake_get_default('header-bar-background-color')));
     // Header text color
     if ($header_text_color !== ttfmake_get_default('header-text-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.site-header', '.site-header a', '.site-navigation .menu li a'), 'declarations' => array('color' => $header_text_color)));
     }
     // Header background color
     if ($header_background_color !== ttfmake_get_default('header-background-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.site-header-main'), 'declarations' => array('background-color' => $header_background_color)));
     }
     // Header background image
     if (!empty($header_background_image)) {
         // Escape the background image URL properly
         $header_background_image = addcslashes(esc_url_raw($header_background_image), '"');
         // Get and escape related options
         $header_background_size = ttfmake_sanitize_choice(get_theme_mod('header-background-size', ttfmake_get_default('header-background-size')), 'header-background-size');
         $header_background_repeat = ttfmake_sanitize_choice(get_theme_mod('header-background-repeat', ttfmake_get_default('header-background-repeat')), 'header-background-repeat');
         $header_background_position = ttfmake_sanitize_choice(get_theme_mod('header-background-position', ttfmake_get_default('header-background-position')), 'header-background-position');
         // All variables are escaped at this point
         ttfmake_get_css()->add(array('selectors' => array('.site-header-main'), 'declarations' => array('background-image' => 'url("' . $header_background_image . '")', 'background-size' => $header_background_size, 'background-repeat' => $header_background_repeat, 'background-position' => $header_background_position . ' center')));
     }
     // Header Bar text color
     if ($header_bar_text_color !== ttfmake_get_default('header-bar-text-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.header-bar'), 'declarations' => array('color' => $header_bar_text_color)));
     }
     // Header Bar border color
     if ($header_bar_border_color !== ttfmake_get_default('header-bar-border-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.header-bar', '.header-bar .search-form input', '.header-social-links li:first-of-type', '.header-social-links li a'), 'declarations' => array('border-color' => $header_bar_border_color)));
     }
     // Header Bar background color
     if ($header_bar_background_color !== ttfmake_get_default('header-bar-background-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.header-bar'), 'declarations' => array('background-color' => $header_bar_background_color)));
     }
     /**
      * Site Title & Tagline section
      */
     $color_site_title = maybe_hash_hex_color(get_theme_mod('color-site-title', ttfmake_get_default('color-site-title')));
     if ($color_site_title !== ttfmake_get_default('color-site-title') || $header_text_color !== $color_site_title) {
         ttfmake_get_css()->add(array('selectors' => array('.site-header .site-title', '.site-header .site-title a'), 'declarations' => array('color' => $color_site_title)));
     }
     /**
      * Main section
      */
     // Get and escape options
     $main_background_color = maybe_hash_hex_color(get_theme_mod('main-background-color', ttfmake_get_default('main-background-color')));
     $main_background_image = get_theme_mod('main-background-image', ttfmake_get_default('main-background-image'));
     $main_content_link_underline = absint(get_theme_mod('main-content-link-underline', ttfmake_get_default('main-content-link-underline')));
     // Main background color
     if ($main_background_color !== ttfmake_get_default('main-background-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.site-content', 'body.mce-content-body'), 'declarations' => array('background-color' => $main_background_color)));
     }
     // Main background image
     if (!empty($main_background_image)) {
         // Escape the background image URL properly
         $main_background_image = addcslashes(esc_url_raw($main_background_image), '"');
         // Get and escape related options
         $main_background_size = ttfmake_sanitize_choice(get_theme_mod('main-background-size', ttfmake_get_default('main-background-size')), 'main-background-size');
         $main_background_repeat = ttfmake_sanitize_choice(get_theme_mod('main-background-repeat', ttfmake_get_default('main-background-repeat')), 'main-background-repeat');
         $main_background_position = ttfmake_sanitize_choice(get_theme_mod('main-background-position', ttfmake_get_default('main-background-position')), 'main-background-position');
         // All variables are escaped at this point
         ttfmake_get_css()->add(array('selectors' => array('.site-content'), 'declarations' => array('background-image' => 'url("' . $main_background_image . '")', 'background-size' => $main_background_size, 'background-repeat' => $main_background_repeat, 'background-position' => $main_background_position . ' top')));
     }
     // Main Content Link Underline
     if (1 === $main_content_link_underline) {
         ttfmake_get_css()->add(array('selectors' => array('.entry-content a'), 'declarations' => array('text-decoration' => 'underline')));
     }
     /**
      * Footer section
      */
     // Get and escape options
     $footer_text_color = maybe_hash_hex_color(get_theme_mod('footer-text-color', ttfmake_get_default('footer-text-color')));
     $footer_border_color = maybe_hash_hex_color(get_theme_mod('footer-border-color', ttfmake_get_default('footer-border-color')));
     $footer_background_color = maybe_hash_hex_color(get_theme_mod('footer-background-color', ttfmake_get_default('footer-background-color')));
     $footer_background_image = get_theme_mod('footer-background-image', ttfmake_get_default('footer-background-image'));
     // Footer text color
     if ($footer_text_color !== ttfmake_get_default('footer-text-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.site-footer'), 'declarations' => array('color' => $footer_text_color)));
     }
     // Footer border color
     if ($footer_border_color !== ttfmake_get_default('footer-border-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.site-footer *:not(select)'), 'declarations' => array('border-color' => $footer_border_color . ' !important')));
     }
     // Footer background color
     if ($footer_background_color !== ttfmake_get_default('footer-background-color')) {
         ttfmake_get_css()->add(array('selectors' => array('.site-footer'), 'declarations' => array('background-color' => $footer_background_color)));
     }
     // Footer background image
     if (!empty($footer_background_image)) {
         // Escape the background image URL properly
         $footer_background_image = addcslashes(esc_url_raw($footer_background_image), '"');
         // Get and escape related options
         $footer_background_size = ttfmake_sanitize_choice(get_theme_mod('footer-background-size', ttfmake_get_default('footer-background-size')), 'footer-background-size');
         $footer_background_repeat = ttfmake_sanitize_choice(get_theme_mod('footer-background-repeat', ttfmake_get_default('footer-background-repeat')), 'footer-background-repeat');
         $footer_background_position = ttfmake_sanitize_choice(get_theme_mod('footer-background-position', ttfmake_get_default('footer-background-position')), 'footer-background-position');
         // All variables are escaped at this point
         ttfmake_get_css()->add(array('selectors' => array('.site-footer'), 'declarations' => array('background-image' => 'url("' . $footer_background_image . '")', 'background-size' => $footer_background_size, 'background-repeat' => $footer_background_repeat, 'background-position' => $footer_background_position . ' center')));
     }
     /**
      * Featured image alignment
      */
     $templates = array('blog', 'archive', 'search', 'post', 'page');
     foreach ($templates as $template_name) {
         $key = 'layout-' . $template_name . '-featured-images-alignment';
         $default = ttfmake_get_default($key);
         $alignment = ttfmake_sanitize_choice(get_theme_mod($key, $default), $key);
         if ($alignment !== $default) {
             ttfmake_get_css()->add(array('selectors' => array('.' . $template_name . ' .entry-header .entry-thumbnail'), 'declarations' => array('text-align' => $alignment)));
         }
     }
 }
Beispiel #9
0
 /**
  * Build the CSS rules for the custom fonts
  *
  * @since  1.0.0.
  *
  * @return void
  */
 function ttfmake_css_legacy_fonts()
 {
     /**
      * Font Families
      */
     // Get and escape options
     $font_site_title = get_theme_mod('font-site-title', ttfmake_get_default('font-site-title'));
     $font_site_title_stack = ttfmake_get_font_stack($font_site_title);
     $font_header = get_theme_mod('font-header', ttfmake_get_default('font-header'));
     $font_header_stack = ttfmake_get_font_stack($font_header);
     $font_body = get_theme_mod('font-body', ttfmake_get_default('font-body'));
     $font_body_stack = ttfmake_get_font_stack($font_body);
     // Site Title Font
     if ($font_site_title !== ttfmake_get_default('font-site-title') && '' !== $font_site_title_stack) {
         ttfmake_get_css()->add(array('selectors' => array('.site-title', '.font-site-title'), 'declarations' => array('font-family' => $font_site_title_stack)));
     }
     // Header Font
     if ($font_header !== ttfmake_get_default('font-header') && '' !== $font_header_stack) {
         ttfmake_get_css()->add(array('selectors' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', '.font-header'), 'declarations' => array('font-family' => $font_header_stack)));
     }
     // Body Font
     if ($font_body !== ttfmake_get_default('font-body') && '' !== $font_body_stack) {
         ttfmake_get_css()->add(array('selectors' => array('body', '.font-body'), 'declarations' => array('font-family' => $font_body_stack)));
     }
     /**
      * Font Sizes
      */
     // Get and escape options
     $font_site_title_size = absint(get_theme_mod('font-site-title-size', ttfmake_get_default('font-site-title-size')));
     $font_site_tagline_size = absint(get_theme_mod('font-site-tagline-size', ttfmake_get_default('font-site-tagline-size')));
     $font_nav_size = absint(get_theme_mod('font-nav-size', ttfmake_get_default('font-nav-size')));
     $font_header_size = absint(get_theme_mod('font-header-size', ttfmake_get_default('font-header-size')));
     $font_widget_size = absint(get_theme_mod('font-widget-size', ttfmake_get_default('font-widget-size')));
     $font_body_size = absint(get_theme_mod('font-body-size', ttfmake_get_default('font-body-size')));
     // Relative font sizes
     $percent = ttfmake_font_get_relative_sizes();
     // Site Title Font Size
     if ($font_site_title_size !== ttfmake_get_default('font-site-title-size')) {
         ttfmake_get_css()->add(array('selectors' => array('.site-title', '.font-site-title'), 'declarations' => array('font-size-px' => $font_site_title_size . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem($font_site_title_size) . 'rem')));
     }
     // Site Tagline Font Size
     if ($font_site_tagline_size !== ttfmake_get_default('font-site-tagline-size')) {
         ttfmake_get_css()->add(array('selectors' => array('.site-description', '.font-site-tagline'), 'declarations' => array('font-size-px' => $font_site_tagline_size . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem($font_site_tagline_size) . 'rem')));
     }
     // Navigation Font Size
     if ($font_nav_size !== ttfmake_get_default('font-nav-size')) {
         // Top level
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu li a', '.font-nav'), 'declarations' => array('font-size-px' => $font_nav_size . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem($font_nav_size) . 'rem')));
         // Sub menu items
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .sub-menu li a', '.site-navigation .menu .children li a'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_nav_size, $percent['sub-menu']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_nav_size, $percent['sub-menu'])) . 'rem'), 'media' => 'screen and (min-width: 800px)'));
         // Grandchild arrow position
         ttfmake_get_css()->add(array('selectors' => array('.site-navigation .menu .sub-menu .menu-item-has-children a:after', '.site-navigation .menu .children .menu-item-has-children a:after'), 'declarations' => array('top' => $font_nav_size * 1.4 / 2 - 5 . 'px'), 'media' => 'screen and (min-width: 800px)'));
     }
     // Header Font Sizes
     if ($font_header_size !== ttfmake_get_default('font-header-size')) {
         // h1
         ttfmake_get_css()->add(array('selectors' => array('h1', '.font-header'), 'declarations' => array('font-size-px' => $font_header_size . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem($font_header_size) . 'rem')));
         // h2
         ttfmake_get_css()->add(array('selectors' => array('h2'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_header_size, $percent['h2']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_header_size, $percent['h2'])) . 'rem')));
         // h3
         ttfmake_get_css()->add(array('selectors' => array('h3', '.builder-text-content .widget-title'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_header_size, $percent['h3']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_header_size, $percent['h3'])) . 'rem')));
         // h4
         ttfmake_get_css()->add(array('selectors' => array('h4'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_header_size, $percent['h4']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_header_size, $percent['h4'])) . 'rem')));
         // h5
         ttfmake_get_css()->add(array('selectors' => array('h5'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_header_size, $percent['h5']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_header_size, $percent['h5'])) . 'rem')));
         // h6
         ttfmake_get_css()->add(array('selectors' => array('h6'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_header_size, $percent['h6']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_header_size, $percent['h6'])) . 'rem')));
         // Post title with two sidebars
         ttfmake_get_css()->add(array('selectors' => array('.has-left-sidebar.has-right-sidebar .entry-title'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_header_size, $percent['post-title']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_header_size, $percent['post-title'])) . 'rem'), 'media' => 'screen and (min-width: 800px)'));
     }
     // Widget Font Size
     if ($font_widget_size !== ttfmake_get_default('font-widget-size')) {
         // Widget body
         ttfmake_get_css()->add(array('selectors' => array('.widget', '.font-widget'), 'declarations' => array('font-size-px' => $font_widget_size . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem($font_widget_size) . 'rem')));
         // Widget title
         ttfmake_get_css()->add(array('selectors' => array('.widget-title'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_widget_size, $percent['widget-title']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_widget_size, $percent['widget-title'])) . 'rem')));
     }
     // Body Font Size
     if ($font_body_size !== ttfmake_get_default('font-body-size')) {
         // body
         ttfmake_get_css()->add(array('selectors' => array('body', '.font-body', '.builder-text-content .widget'), 'declarations' => array('font-size-px' => $font_body_size . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem($font_body_size) . 'rem')));
         // Comments
         ttfmake_get_css()->add(array('selectors' => array('#comments'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_body_size, $percent['comments']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_body_size, $percent['comments'])) . 'rem')));
         // Comment date
         ttfmake_get_css()->add(array('selectors' => array('.comment-date'), 'declarations' => array('font-size-px' => ttfmake_get_relative_font_size($font_body_size, $percent['comment-date']) . 'px', 'font-size-rem' => ttfmake_convert_px_to_rem(ttfmake_get_relative_font_size($font_body_size, $percent['comment-date'])) . 'rem')));
     }
 }