Пример #1
0
/**
 * Custom CSS built from user theme options
 * For proper sanitization, always use functions from hoot/includes/sanitization.php
 * and hoot/customizer/sanitization.php
 *
 * @since 1.0
 * @access public
 */
function hoot_dynamic_cssrules()
{
    /*** Settings Values ***/
    /* Lite Settings */
    $settings = array();
    $settings['grid_width'] = intval(hoot_get_mod('site_width', 1260)) . 'px';
    $settings['accent_color'] = hoot_get_mod('accent_color');
    $settings['accent_color_dark'] = hoot_color_increase($settings['accent_color'], 20, 20);
    $settings['accent_font'] = hoot_get_mod('accent_font');
    $settings['site_layout'] = hoot_get_mod('site_layout');
    extract(apply_filters('hoot_custom_css_settings', $settings, 'lite'));
    /*** Add Dynamic CSS ***/
    /* Hoot Grid */
    hoot_add_css_rule(array('selector' => '.grid', 'property' => 'max-width', 'value' => $grid_width, 'idtag' => 'grid_width'));
    /* Base Typography and HTML */
    hoot_add_css_rule(array('selector' => 'a', 'property' => 'color', 'value' => $accent_color, 'idtag' => 'accent_color'));
    // Overridden in premium
    hoot_add_css_rule(array('selector' => '.invert-typo', 'property' => array('background' => array($accent_color, 'accent_color'), 'color' => array($accent_font, 'accent_font'))));
    hoot_add_css_rule(array('selector' => '.invert-typo a, .invert-typo a:hover, .invert-typo h1, .invert-typo h2, .invert-typo h3, .invert-typo h4, .invert-typo h5, .invert-typo h6, .invert-typo .title', 'property' => 'color', 'value' => $accent_font, 'idtag' => 'accent_font'));
    hoot_add_css_rule(array('selector' => 'input[type="submit"], #submit, .button', 'property' => array('background' => array($accent_color, 'accent_color'), 'color' => array($accent_font, 'accent_font'))));
    hoot_add_css_rule(array('selector' => 'input[type="submit"]:hover, #submit:hover, .button:hover', 'property' => array('background' => array($accent_color_dark, 'accent_color'), 'color' => array($accent_font, 'accent_font'))));
    /* Layout */
    hoot_add_css_rule(array('selector' => 'body', 'property' => 'background', 'idtag' => 'background'));
    if ($site_layout == 'boxed') {
        hoot_add_css_rule(array('selector' => '#page-wrapper', 'property' => 'background', 'idtag' => 'box_background'));
    }
    /* Header */
    hoot_add_css_rule(array('selector' => '#site-title, #site-title a', 'property' => 'color', 'value' => $accent_color, 'idtag' => 'accent_color'));
    // Overridden in premium
    /* Sidebars and Widgets */
    hoot_add_css_rule(array('selector' => '.content-block-icon', 'property' => array('color' => array($accent_color, 'accent_color'), 'background' => array($accent_font, 'accent_font'), 'border-color' => array($accent_color, 'accent_color'))));
    hoot_add_css_rule(array('selector' => '.content-block-icon.icon-style-square', 'property' => array('color' => array($accent_font, 'accent_font'), 'background' => array($accent_color, 'accent_color'))));
    hoot_add_css_rule(array('selector' => '.content-blocks-widget .content-block:hover .content-block-icon.icon-style-circle', 'property' => array('color' => array($accent_font, 'accent_font'), 'background' => array($accent_color, 'accent_color'))));
    hoot_add_css_rule(array('selector' => '.content-blocks-widget .content-block:hover .content-block-icon.icon-style-square', 'property' => array('color' => array($accent_color, 'accent_color'), 'background' => array($accent_font, 'accent_font'))));
    /* Light Slider */
    hoot_add_css_rule(array('selector' => '.lSSlideOuter .lSPager.lSpg > li:hover a, .lSSlideOuter .lSPager.lSpg > li.active a', 'property' => 'background-color', 'value' => $accent_color, 'idtag' => 'accent_color'));
}
Пример #2
0
/**
 * Custom CSS built from user theme options
 * For proper sanitization, always use functions from hoot/functions/css-styles.php
 *
 * @since 1.0
 * @access public
 */
function hoot_custom_css()
{
    $css = '';
    $vars = array();
    $accent_color = hoot_get_option('accent_color');
    $accent_color_dark = hoot_color_increase($accent_color, 10, 10);
    $accent_font = hoot_get_option('accent_font');
    $cssrules = array();
    // Hoot Grid
    $cssrules['.grid'] = hoot_css_grid_width();
    // Base Typography and HTML
    $cssrules['a'] = hoot_css_rule('color', $accent_color);
    // Overridden by hoot_premium_custom_cssrules()
    $cssrules['.invert-typo'] = array(hoot_css_rule('background', $accent_color), hoot_css_rule('color', $accent_font));
    $cssrules['.invert-typo a, .invert-typo a:hover, .invert-typo h1, .invert-typo h2, .invert-typo h3, .invert-typo h4, .invert-typo h5, .invert-typo h6, .invert-typo .title'] = hoot_css_rule('color', $accent_font);
    $cssrules['input[type="submit"], #submit, .button'] = array(hoot_css_rule('background', $accent_color), hoot_css_rule('color', $accent_font));
    $cssrules['input[type="submit"]:hover, #submit:hover, .button:hover'] = array(hoot_css_rule('background', $accent_color_dark), hoot_css_rule('color', $accent_font));
    // Override @headingsFontFamily if selected in options
    if ('cursive' != hoot_get_option('headings_fontface')) {
        $cssrules['h1, h2, h3, h4, h5, h6, .title, .titlefont'] = array(hoot_css_rule('font-family', '"Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif'), hoot_css_rule('font-weight', '300'), hoot_css_rule('color', '#000000'));
    }
    // Layout
    $content_bg = hoot_get_option('background');
    $cssrules['body'][] = hoot_css_background($content_bg);
    if (hoot_get_option('site_layout') == 'boxed') {
        $content_bg = array('color' => hoot_get_option('box_background_color'));
        $cssrules['#page-wrapper'][] = hoot_css_background($content_bg);
    }
    $vars['content_bg'] = $content_bg;
    // Header (Topbar, Header, Main Nav Menu)
    // Topbar
    $cssrules['.topbar-right-inner input'] = hoot_css_rule('background', $content_bg['color']);
    // Header Layout
    if (hoot_get_option('logo_background_type') == 'accent') {
        $cssrules['#header:before'] = hoot_css_rule('background', $accent_color);
    } else {
        $cssrules['#header:before, #site-logo'] = hoot_css_rule('background', 'transparent');
        $cssrules['#header, #branding, #header-aside'] = hoot_css_rule('background', 'none');
        $cssrules['#site-logo #site-title, #site-logo #site-description'] = hoot_css_rule('color', $accent_color);
    }
    // Logo (with icon)
    $title_icon_size = hoot_get_option('site_title_icon_size', NULL);
    if (intval($title_icon_size)) {
        $cssrules['.site-logo-with-icon #site-title i'] = hoot_css_rule('font-size', $title_icon_size);
    }
    $title_icon = hoot_get_option('site_title_icon', NULL);
    if ($title_icon && intval($title_icon_size)) {
        $cssrules['.site-logo-with-icon #site-title'] = hoot_css_rule('padding-left', $title_icon_size);
    }
    // Mixed Logo (with image)
    $logo_image_width = hoot_get_option('logo_image_width', NULL);
    $logo_image_width = intval($logo_image_width) ? intval($logo_image_width) : 120;
    $cssrules['.site-logo-with-image .site-logo-mixed-image, .site-logo-with-image .site-logo-mixed-image img'] = hoot_css_rule('width', intval($logo_image_width) . 'px');
    // Important to have logo img width as img does not follow max-width inside non-fixed tables in Firefox
    // Custom Logo
    $hoot_logo = hoot_get_option('logo');
    if ('custom' == $hoot_logo || 'mixedcustom' == $hoot_logo) {
        $title_custom = apply_filters('hoot_logo_custom_text', hoot_get_option('logo_custom'));
        if (is_array($title_custom) && !empty($title_custom)) {
            $lcount = 1;
            foreach ($title_custom as $title_line) {
                if (!empty($title_line['size'])) {
                    $cssrules['#site-logo-custom .site-title-line' . $lcount . ',#site-logo-mixedcustom .site-title-line' . $lcount] = hoot_css_rule('font-size', $title_line['size']);
                }
                $lcount++;
            }
        }
    }
    // Light Slider
    $cssrules['.lSSlideOuter .lSPager.lSpg > li:hover a, .lSSlideOuter .lSPager.lSpg > li.active a'] = hoot_css_rule('background-color', $accent_color);
    // Allow CSS to be modified
    $cssrules = apply_filters('hoot_dynamic_cssrules', $cssrules, $vars);
    /** Print CSS Rules **/
    foreach ($cssrules as $selector => $rules) {
        if (!empty($selector)) {
            $css .= $selector . ' {';
            if (is_array($rules)) {
                foreach ($rules as $rule) {
                    $css .= $rule . ' ';
                }
            } else {
                $css .= $rules;
            }
            $css .= ' }' . "\n";
        }
    }
    // @todo add media queries to preceding code
    // Allow CSS to be modified
    $cssrules = apply_filters('hoot_dynamic_css', $css, $vars);
    // Print CSS
    if (!empty($css)) {
        wp_add_inline_style('style', $css);
    }
}
Пример #3
0
/**
 * Custom CSS built from user theme options
 * For proper sanitization, always use functions from hoot/includes/sanitization.php
 * and hoot/customizer/sanitization.php
 *
 * @since 1.0
 * @access public
 */
function hoot_dynamic_cssrules()
{
    /*** Settings Values ***/
    /* Lite Settings */
    $settings = array();
    $settings['grid_width'] = intval(hoot_get_mod('site_width', 1260)) . 'px';
    $settings['accent_color'] = hoot_get_mod('accent_color');
    $settings['accent_color_dark'] = hoot_color_increase($settings['accent_color'], 10, 10);
    $settings['accent_font'] = hoot_get_mod('accent_font');
    $settings['headings_fontface'] = hoot_get_mod('headings_fontface');
    $settings['site_layout'] = hoot_get_mod('site_layout');
    $settings['box_background_color'] = hoot_get_mod('box_background_color');
    $settings['content_bg_color'] = $settings['site_layout'] == 'boxed' ? $settings['box_background_color'] : hoot_get_mod('background-color');
    $settings['logo_background_type'] = hoot_get_mod('logo_background_type');
    $settings['site_title_icon_size'] = hoot_get_mod('site_title_icon_size');
    $settings['site_title_icon'] = hoot_get_mod('site_title_icon');
    $settings['logo_image_width'] = hoot_get_mod('logo_image_width');
    $settings['logo_image_width'] = intval($settings['logo_image_width']) ? intval($settings['logo_image_width']) . 'px' : '120px';
    $settings['logo'] = hoot_get_mod('logo');
    $settings['logo_custom'] = apply_filters('hoot_logo_custom_text', hoot_sortlist(hoot_get_mod('logo_custom')));
    extract(apply_filters('hoot_custom_css_settings', $settings, 'lite'));
    /*** Add Dynamic CSS ***/
    /* Hoot Grid */
    hoot_add_css_rule(array('selector' => '.grid', 'property' => 'max-width', 'value' => $grid_width, 'idtag' => 'grid_width'));
    /* Base Typography and HTML */
    hoot_add_css_rule(array('selector' => 'a', 'property' => 'color', 'value' => $accent_color, 'idtag' => 'accent_color'));
    // Overridden in premium
    hoot_add_css_rule(array('selector' => '.invert-typo', 'property' => array('background' => array($accent_color, 'accent_color'), 'color' => array($accent_font, 'accent_font'))));
    hoot_add_css_rule(array('selector' => '.invert-typo a, .invert-typo a:hover, .invert-typo h1, .invert-typo h2, .invert-typo h3, .invert-typo h4, .invert-typo h5, .invert-typo h6, .invert-typo .title', 'property' => 'color', 'value' => $accent_font, 'idtag' => 'accent_font'));
    hoot_add_css_rule(array('selector' => 'input[type="submit"], #submit, .button', 'property' => array('background' => array($accent_color, 'accent_color'), 'color' => array($accent_font, 'accent_font'))));
    hoot_add_css_rule(array('selector' => 'input[type="submit"]:hover, #submit:hover, .button:hover', 'property' => array('background' => array($accent_color_dark, 'accent_color'), 'color' => array($accent_font, 'accent_font'))));
    if ('cursive' != $headings_fontface) {
        // Override @headingsFontFamily if selected in options
        hoot_add_css_rule(array('selector' => 'h1, h2, h3, h4, h5, h6, .title, .titlefont', 'property' => array('font-family' => array('"Open Sans", sans-serif'), 'font-weight' => array('300'), 'color' => array('#000000'))));
    }
    /* Layout */
    hoot_add_css_rule(array('selector' => 'body', 'property' => 'background', 'idtag' => 'background'));
    if ($site_layout == 'boxed') {
        hoot_add_css_rule(array('selector' => '#page-wrapper', 'property' => 'background', 'value' => $box_background_color, 'idtag' => 'box_background_color'));
    }
    /* Header (Topbar, Header, Main Nav Menu) */
    // Topbar
    hoot_add_css_rule(array('selector' => '.topbar-right-inner input', 'property' => 'background', 'value' => $content_bg_color));
    /* Header (Topbar, Header, Main Nav Menu) */
    // Header Layout
    if ($logo_background_type == 'accent') {
        hoot_add_css_rule(array('selector' => '#header:before', 'property' => 'background', 'value' => $accent_color, 'idtag' => 'accent_color'));
    } else {
        hoot_add_css_rule(array('selector' => '#header:before, #site-logo', 'property' => 'background', 'value' => 'none'));
        hoot_add_css_rule(array('selector' => '#header, #branding, #header-aside', 'property' => 'background', 'value' => 'none'));
        hoot_add_css_rule(array('selector' => '#site-logo #site-title, #site-logo #site-description', 'property' => 'color', 'value' => $accent_color, 'idtag' => 'accent_color'));
        // Overridden in premium
    }
    /* Header (Topbar, Header, Main Nav Menu) */
    // Logo (with icon)
    if (intval($site_title_icon_size)) {
        hoot_add_css_rule(array('selector' => '.site-logo-with-icon #site-title i', 'property' => 'font-size', 'value' => $site_title_icon_size, 'idtag' => 'site_title_icon_size'));
    }
    if ($site_title_icon && intval($site_title_icon_size)) {
        hoot_add_css_rule(array('selector' => '.site-logo-with-icon #site-title', 'property' => 'padding-left', 'value' => $site_title_icon_size, 'idtag' => 'site_title_icon_size'));
    }
    /* Header (Topbar, Header, Main Nav Menu) */
    // Mixed Logo (with image)
    hoot_add_css_rule(array('selector' => '.site-logo-with-image .site-logo-mixed-image, .site-logo-with-image .site-logo-mixed-image img', 'property' => 'width', 'value' => $logo_image_width, 'idtag' => 'logo_image_width'));
    // Important to have logo img width as img does not follow max-width inside non-fixed tables in Firefox
    /* Header (Topbar, Header, Main Nav Menu) */
    // Custom Logo
    if ('custom' == $logo || 'mixedcustom' == $logo) {
        if (is_array($logo_custom) && !empty($logo_custom)) {
            $lcount = 1;
            foreach ($logo_custom as $logo_custom_line) {
                if (!$logo_custom_line['sortitem_hide'] && !empty($logo_custom_line['size'])) {
                    hoot_add_css_rule(array('selector' => '#site-logo-custom .site-title-line' . $lcount . ',#site-logo-mixedcustom .site-title-line' . $lcount, 'property' => 'font-size', 'value' => $logo_custom_line['size']));
                }
                $lcount++;
            }
        }
    }
    /* Light Slider */
    hoot_add_css_rule(array('selector' => '.lSSlideOuter .lSPager.lSpg > li:hover a, .lSSlideOuter .lSPager.lSpg > li.active a', 'property' => 'background-color', 'value' => $accent_color, 'idtag' => 'accent_color'));
}