Ejemplo n.º 1
0
/*  for PRO users! - *
 * Generate all the css declared in customizer's config
 * ====== DO NOT EDIT BELOW!!! =======
 * If you need to add custom css rules add them above so we can keep track of them
 */
$redux_sections = wpgrade::get_redux_sections();
if (is_array($redux_sections) || is_object($redux_sections)) {
    foreach ($redux_sections as $key => $section) {
        if (isset($section['fields'])) {
            foreach ($section['fields'] as $i => $field) {
                if (isset($field['customizer']) && isset($field['customizer']['css_rules'])) {
                    foreach ($field['customizer']['css_rules'] as $key => $rule) {
                        //rebuild the option value for each rule
                        $option_value = wpgrade::option($field['id']);
                        // @TODO  make from this a method used also in customizer
                        wpgrade::display_dynamic_css_rule($rule, $key, $option_value);
                    }
                }
            }
        }
    }
}
/*  for PRO users! - *
 *======= TYPOGRAPHY
 */
$fonts = array();
if (wpgrade::option('use_google_fonts')) {
    $fonts_array = array('google_titles_font', 'google_subtitles_font', 'google_nav_font', 'google_body_font');
    foreach ($fonts_array as $font) {
        $the_font = wpgrade::get_the_typo($font);
        if (isset($the_font['font-family']) && !empty($the_font['font-family'])) {
Ejemplo n.º 2
0
        /**
         * This will output the custom WordPress settings to the live theme's WP head.
         * Used by hook: 'wp_head'
         * @see   add_action('wp_head',$func)
         * @since MyTheme 1.0
         */
        public function header_output()
        {
            if (!isset($GLOBALS['wp_customize'])) {
                return;
            }
            // iterate through options and setup an style for those who need an embeded style
            foreach ($this->parent->sections as $key => $section) {
                // Not a type that should go on the customizer
                if (empty($section['fields']) || isset($section['type']) && $section['type'] == "divide") {
                    continue;
                }
                // If section customizer is set to false
                if (isset($section['customizer']) && $section['customizer'] === false) {
                    continue;
                }
                foreach ($section['fields'] as $skey => $option) {
                    if (isset($option['customizer']) && $option['customizer'] === false) {
                        continue;
                    }
                    if ($this->parent->args['customizer'] === false && (!isset($option['customizer']) || !is_array($option['customizer']))) {
                        continue;
                    }
                    // @TODO maybe refactor here
                    if (!isset($option['customizer']) || !is_array($option['customizer'])) {
                        continue;
                    }
                    // to localize setting
                    $tlcs = array();
                    if (isset($option['customizer']['selector'])) {
                        $tlcs['selector'] = $option['customizer']['selector'];
                    }
                    if (isset($option['customizer']['rules'])) {
                        $tlcs['rules'] = $option['customizer']['rules'];
                    }
                    if (isset($option['customizer']['css_rules'])) {
                        $tlcs['css_rules'] = $option['customizer']['css_rules'];
                    }
                    if (isset($option['customizer']['transport'])) {
                        $tlcs['transport'] = $option['customizer']['transport'];
                    }
                    if (isset($option['type'])) {
                        $tlcs['type'] = $option['type'];
                    }
                    if (!isset($tlcs['css_rules']) || !is_array($tlcs['css_rules'])) {
                        continue;
                    }
                    //					$option_value = wpgrade::option( $option['id'], $option['default'] );// ( isset($option['value'] ) ) ? $option['value'] : $option['default'];
                    ?>
					<style id="<?php 
                    echo $option['id'];
                    ?>
" type="text/css"><?php 
                    foreach ($tlcs['css_rules'] as $key => $rule) {
                        // rebuild the option value for each rule
                        $option_value = wpgrade::option($option['id']);
                        // get the rule
                        wpgrade::display_dynamic_css_rule($rule, $key, $option_value, $important = false);
                    }
                    ?>
					</style>
				<?php 
                }
            }
        }