/** * Enqueue Google Fonts Example */ function smtm_fonts() { // Font options $fonts = array(get_theme_mod('primary-font', customizer_library_get_default('primary-font')), get_theme_mod('secondary-font', customizer_library_get_default('secondary-font')), get_theme_mod('tertiary-font', customizer_library_get_default('tertiary-font'))); $font_uri = customizer_library_get_google_font_uri($fonts); // Load Google Fonts wp_enqueue_style('smtm_fonts', $font_uri, array(), null, 'screen'); }
/** * Custom render function for Infinite Scroll. */ function politics_infinite_scroll_render() { $politics_blog_style = get_theme_mod('politics_blog_style', customizer_library_get_default('politics_blog_style')); while (have_posts()) { the_post(); get_template_part('template-parts/content', $politics_blog_style); } }
/** * Enqueue Google Fonts Example */ function customizer_topshop_theme_fonts() { // Font options $fonts = array(get_theme_mod('topshop-body-font', customizer_library_get_default('topshop-body-font')), get_theme_mod('topshop-heading-font', customizer_library_get_default('topshop-heading-font'))); $font_uri = customizer_library_get_google_font_uri($fonts); // Load Google Fonts wp_enqueue_style('customizer_topshop_theme_fonts', $font_uri, array(), null, 'screen'); }
/** * Generates the style tag and CSS needed for the theme options. * * By using the "Customizer_Library_Styles" filter, different components can print CSS in the header. * It is organized this way to ensure there is only one "style" tag. * * @since 1.0.0. * * @return void */ function customizer_library_gateway_styles() { do_action('customizer_library_styles'); // Echo the rules $css = Customizer_Library_Styles()->build(); $home_hero_bg = get_theme_mod('home_hero_bg', customizer_library_get_default('home_hero_bg')); $home_hero_bg_color = get_theme_mod('home_hero_bg_color', customizer_library_get_default('home_hero_bg_color')); $header_bg = get_theme_mod('header_bg', customizer_library_get_default('header_bg')); $header_color = get_theme_mod('header_color', customizer_library_get_default('header_color')); $bg_attachement = get_theme_mod('bg_attachement', customizer_library_get_default('bg_attachement')); echo "\n<!-- Begin Custom CSS -->\n<style type=\"text/css\" id=\"rescue_custom_css\">\n"; ?> .home-header-bg { background:url( '<?php echo esc_url($home_hero_bg); ?> ' ) <?php echo esc_attr($home_hero_bg_color); ?> no-repeat center center <?php echo esc_attr($bg_attachement); ?> ; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .header-bg { background:url( '<?php echo esc_url($header_bg); ?> ' ) <?php echo esc_attr($header_color); ?> no-repeat center center <?php echo esc_attr($bg_attachement); ?> ; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } <?php echo "\n</style>\n<!-- End Custom CSS -->\n"; if (!empty($css)) { echo "\n<!-- Begin Custom CSS -->\n<style type=\"text/css\" id=\"gateway-custom-css\">\n"; echo $css; echo "\n</style>\n<!-- End Custom CSS -->\n"; } }
/** * Sanitize a value from a list of allowed values. * * @since 1.0.0. * * @param mixed $value The value to sanitize. * @param mixed $setting The setting for which the sanitizing is occurring. * @return mixed The sanitized value. */ function customizer_library_sanitize_choices($value, $setting) { if (is_object($setting)) { $setting = $setting->id; } $choices = customizer_library_get_choices($setting); $allowed_choices = array_keys($choices); if (!in_array($value, $allowed_choices)) { $value = customizer_library_get_default($setting); } return $value; }
/** * Outputs the number of masonry columns as a data attribute * * @since Gather 0.1 */ function gather_get_columns() { $layout = get_theme_mod('archive-layout', customizer_library_get_default('archive-layout')); switch ($layout) { case '4-column-masonry': return '4'; case '3-column-masonry': return '3'; case '2-column-masonry': return '2'; default: return '0'; } }
function bfg_customizer_build_styles() { if (get_theme_mod('custom-font', false)) { // Heading font $setting = 'heading-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.footer-widgets .widgettitle', '.widgettitle', '.h1', '.h2', '.h3', '.h4', '.h5', '.h6', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', '.widget_recent_entries li a'), 'declarations' => array('font-family' => $stack))); } // Body Font $setting = 'body-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('body', '.popover', '.tooltip', '.widget_recent_entries li span', '.site-header .site-description'), 'declarations' => array('font-family' => $stack))); } } }
/** * Build the HTTP request URL for Google Fonts. * * @since 1.0.0. * * @return string The URL for including Google Fonts. */ function customizer_library_get_google_font_uri($fonts) { // De-dupe the fonts $fonts = array_unique($fonts); $allowed_fonts = customizer_library_get_google_fonts(); $family = array(); // Validate each font and convert to URL format foreach ($fonts as $font) { $font = trim($font); // Verify that the font exists if (array_key_exists($font, $allowed_fonts)) { // Build the family name and variant string (e.g., "Open+Sans:regular,italic,700") $family[] = urlencode($font . ':' . join(',', customizer_library_choose_google_font_variants($font, $allowed_fonts[$font]['variants']))); } } // Convert from array to string if (empty($family)) { return ''; } else { $request = '//fonts.googleapis.com/css?family=' . implode('%7C', $family); } // Load the font subset $subset = get_theme_mod('font-subset', customizer_library_get_default('font-subset')); if ('all' === $subset) { $subsets_available = customizer_library_get_google_font_subsets(); // Remove the all set unset($subsets_available['all']); // Build the array $subsets = array_keys($subsets_available); } else { $subsets = array('latin', $subset); } // Append the subset string if (!empty($subsets)) { $request .= urlencode('&subset=' . join(',', $subsets)); } return esc_url($request); }
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function customizer_library_demo_build_styles() { // Primary Color $setting = 'primary-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.primary'), 'declarations' => array('color' => $color))); } // Secondary Color $setting = 'secondary-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.secondary'), 'declarations' => array('color' => $color))); } // Border Color $setting = 'border'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.border'), 'declarations' => array('border-color' => $color))); } // Primary Font $setting = 'primary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.primary'), 'declarations' => array('font-family' => $stack))); } // Secondary Font $setting = 'secondary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.secondary'), 'declarations' => array('font-family' => $stack))); } }
body_class(); ?> > <div id="page" class="hfeed site"> <a class="skip-link screen-reader-text" href="#content"><?php _e('Skip to content', 'gateway'); ?> </a> <div class="bg-image bg-image-header bg-center-center"> <div class="site-branding"> <?php $header_logo = get_theme_mod('header_logo', customizer_library_get_default('header_logo')); if (!$header_logo) { ?> <h1 class="site-title"><a href="<?php echo esc_url(home_url('/')); ?> " rel="home" alt="<?php bloginfo('name'); ?> "><?php bloginfo('name'); ?> </a></h1> <h2><?php
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function gather_styles() { // Primary Color $setting = 'primary-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); $color_obj = new Jetpack_Color($color); // Link Styling Customizer_Library_Styles()->add(array('selectors' => array('a', '.site-title a'), 'declarations' => array('color' => $color))); // Button Styling Customizer_Library_Styles()->add(array('selectors' => array('button', '.button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]', '.masonry .entry-footer-meta a:hover'), 'declarations' => array('background-color' => $color))); // Button Hover State Customizer_Library_Styles()->add(array('selectors' => array('button:hover', '.button:hover', 'input[type="button"]:hover', 'input[type="reset"]:hover', 'input[type="submit"]:hover'), 'declarations' => array('background-color' => $color_obj->darken(5)))); // Border Colors Customizer_Library_Styles()->add(array('selectors' => array('#content blockquote', '.page-header'), 'declarations' => array('border-color' => $mod))); } // Secondary Color $setting = 'secondary-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { // Colors Customizer_Library_Styles()->add(array('selectors' => array('.site-title a:hover', '.bypostauthor .comment-author .fn:after'), 'declarations' => array('color' => sanitize_hex_color($color)))); } // Primary Font $setting = 'primary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('body', '.site-description', '.widget-title', '.comments-title', '#reply-title'), 'declarations' => array('font-family' => $stack))); } // Secondary Font $setting = 'secondary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6', '.comment-author'), 'declarations' => array('font-family' => $stack))); } // Menu Styling $menus = array('primary', 'secondary'); foreach ($menus as $menu) { if (!has_nav_menu($menu)) { break; } if ($menu == 'primary') { $selector = '#primary-navigation' . ' '; } if ($menu == 'secondary') { $selector = '#secondary-navigation' . ' '; } // Background $setting = $menu . '-menu-background'; $mod = get_theme_mod($setting, false); if ($mod) { Customizer_Library_Styles()->add(array('selectors' => array($selector, $selector . 'ul ul a:hover'), 'declarations' => array('background-color' => $mod))); } // Background Hover $setting = $menu . '-menu-background-hover'; $mod = get_theme_mod($setting, false); if ($mod) { Customizer_Library_Styles()->add(array('selectors' => array($selector . 'a:hover', $selector . 'li:hover a'), 'declarations' => array('background-color' => $mod))); } // Navigation Text $setting = $menu . '-menu-color'; $mod = get_theme_mod($setting, false); if ($mod) { Customizer_Library_Styles()->add(array('selectors' => array($selector . 'a', $selector . 'a:hover', $selector . 'li:hover a', $selector . '.dropdown-toggle:after'), 'declarations' => array('color' => $mod))); } // Border $setting = $menu . '-menu-border'; $mod = get_theme_mod($setting, false); if ($mod) { Customizer_Library_Styles()->add(array('selectors' => array($selector . 'ul', $selector . 'a', $selector . '.dropdown-toggle', $selector . 'ul ul', $selector . 'ul ul a', $selector . 'ul li:hover ul a', $selector . 'ul ul ul'), 'declarations' => array('border-color' => $mod))); } } // Header Background Color $setting = 'header-background-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.site-branding'), 'declarations' => array('background-color' => $mod))); } // Header Background Image $setting = 'header-background-image'; $mod = get_theme_mod($setting, false); if ($mod) { Customizer_Library_Styles()->add(array('selectors' => array('.site-branding'), 'declarations' => array('background-image' => 'url(' . $mod . ')'))); } // Header Background Image Styles $setting = 'header-background-image-style'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.site-branding'), 'declarations' => array('background-size' => 'auto auto', 'background-repeat' => 'repeat', 'background-position' => '0 0'))); } // Center Header Text $setting = 'center-branding'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod) { Customizer_Library_Styles()->add(array('selectors' => array('.site-branding'), 'declarations' => array('text-align' => 'center'))); } // Site Title Color $setting = 'site-title-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.site-title a'), 'declarations' => array('color' => $mod))); } // Site Title Color $setting = 'site-title-hover-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.site-title a:hover'), 'declarations' => array('color' => $mod))); } // Site Title Font $setting = 'site-title-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.site-title'), 'declarations' => array('font-family' => $stack))); } // Site Tagline Color $setting = 'site-tagline-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.site-description'), 'declarations' => array('color' => $mod))); } }
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function customizer_library_smtm_build_styles() { // Primary Color $setting = 'primary-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.primary', 'a', 'a:hover'), 'declarations' => array('color' => $color))); Customizer_Library_Styles()->add(array('selectors' => array('a:hover'), 'declarations' => array('opacity' => 0.8))); } // Secondary Color $setting = 'secondary-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.secondary'), 'declarations' => array('color' => $color))); } // header Color $setting = 'header-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('header.the-header'), 'declarations' => array('background-color' => $color))); Customizer_Library_Styles()->add(array('selectors' => array('header.the-header .widget_nav_menu a:hover, header.the-header .widget_nav_menu .current-menu-item a'), 'declarations' => array('color' => $color))); } // footer Color $setting = 'footer-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('footer'), 'declarations' => array('background-color' => $color))); } // Background Color $setting = 'background-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('body, html'), 'declarations' => array('background-color' => $color))); } // Primary Font $setting = 'primary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', '.widget-title', '.title'), 'declarations' => array('font-family' => $stack))); } // Secondary Font $setting = 'secondary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('p', 'span', 'div', 'a'), 'declarations' => array('font-family' => $stack))); } // Special Font $setting = 'tertiary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.widget_site_name_widget > a > h1', '.special'), 'declarations' => array('font-family' => $stack))); } }
dynamic_sidebar('footer'); ?> </div> </div><!-- .footer-widgets --> <?php } ?> <footer id="colophon" class="site-footer" role="contentinfo"> <div class="col-width"> <?php if (get_theme_mod('footer-text', customizer_library_get_default('footer-text')) != '') { ?> <div class="site-info"> <?php echo get_theme_mod('footer-text', customizer_library_get_default('footer-text')); ?> </div><!-- .site-info --> <?php } ?> </div><!-- .col-width --> </footer><!-- #colophon --> </div><!-- #page --> <?php wp_footer(); ?> </body>
/** * Enqueue fonts. */ function gather_fonts() { // Font options $fonts = array(); // Site title font only required when logo not in use if (!get_theme_mod('logo', 0)) { $fonts[0] = get_theme_mod('site-title-font', customizer_library_get_default('site-title-font')); } $fonts[1] = get_theme_mod('primary-font', customizer_library_get_default('primary-font')); $fonts[2] = get_theme_mod('secondary-font', customizer_library_get_default('secondary-font')); $font_uri = customizer_library_get_google_font_uri($fonts); // Load Google Fonts wp_enqueue_style('gather-body-fonts', $font_uri, array(), null, 'screen'); // Icon Font wp_enqueue_style('gather-icons', get_template_directory_uri() . '/fonts/gather-icons.css', array(), '0.4.0'); }
} ?> </div> </div><!-- .row --> <div class="row"> <div class="large-12 columns"> <hr> <div class="copyright-info"> <?php $footer_copyright = get_theme_mod('footer_copyright', customizer_library_get_default('footer_copyright')); echo wp_kses($footer_copyright, array('strong' => array(), 'a' => array('href' => array(), 'title' => array()))); ?> </div><!-- .copyright-info --> </div><!-- .large-12 --> </div><!-- .row --> </footer><!-- #colophon --> </div><!-- .footer-wrap --> <?php wp_footer();
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function customizer_library_demo_build_styles() { // Link Hover Color $setting = 'link_hover_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('a:hover, a:focus, article .entry-meta a:hover, footer.entry_meta .post_details a:hover, .footer_widget a:hover, .footer_widget a:focus, .footer_widget a.custom:hover, .footer_widget a.custom:focus, .copyright a:hover, .footer_copyright .copyright a:hover, .footer_social a:hover, .top_header_wrap .logo h3 a:hover, .top_header_wrap h1.site-title a:hover'), 'declarations' => array('color' => $color))); } // Sitewide Buttons Color $setting = 'button_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('button, .button, article .entry-meta .rescue_staff, .inner_content ul.pagination li.arrow a, .inner_content ul.pagination li span.current, a.tribe-events-read-more:hover, .wpcf7 input[type="submit"], .search .search-form input[type="submit"], .search .search-form input[type="submit"]:hover, #comments .rescue_staff, .widget_recent_entries span, .widget input[type="submit"], .format-quote .entry-content, .format-link .entry-content, .single-tribe_events .tribe-events-schedule .tribe-events-cost, a.tribe-events-read-more, .events-list .tribe-events-event-cost span, #tribe-bar-form .tribe-bar-submit input[type="submit"]'), 'declarations' => array('background-color' => $color))); } // Sitewide Button Hover Color $setting = 'main_button_hover'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('button:hover, button:focus, .button:hover, .button:focus, .wpcf7 input[type="submit"]:hover, .widget input[type="submit"]:hover, a.tribe-events-read-more:hover, #tribe-bar-form .tribe-bar-submit input[type="submit"]:hover'), 'declarations' => array('background-color' => $color))); } // Sitewide Button Border Color $setting = 'link_hover_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('button, .button'), 'declarations' => array('border-color' => $color))); } // Blockquote Color $setting = 'link_hover_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('blockquote, .format-link'), 'declarations' => array('border-left-color' => $color))); } // Donation Button Color $setting = 'donate_bg_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.donation_button .button'), 'declarations' => array('background' => $color))); } // Donation Button Border Color $setting = 'donate_border_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.donation_button .button'), 'declarations' => array('border-color' => $color))); } // Donation Button Color Hover $setting = 'donate_bg_color_hover'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.donation_button .button:hover, .donation_button .button:focus'), 'declarations' => array('background' => $color))); } // Donation Button Border Color Hover $setting = 'donate_border_color_hover'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.donation_button .button:hover, .donation_button .button:focus'), 'declarations' => array('border-color' => $color))); } // Header Top Background Color $setting = 'header_top_bg_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.top_header_wrap, .top_header_wrap nav, .top_header_wrap .top-bar-section li:not(.has-form) a:not(.button), .top_header_wrap .top-bar-section .dropdown li:not(.has-form) a:not(.button), .top_header_wrap .top-bar-section ul, .top_header_wrap .top-bar.expanded .title-area'), 'declarations' => array('background' => $color))); } // Top Header Navigation Link Color $setting = 'header_top_nav_link_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.top_header_wrap .top_nav a'), 'declarations' => array('color' => $color))); } // Top Header Navigation Link Hover Color $setting = 'header_top_nav_link_color_hover'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.top-bar-section ul li:hover:not(.has-form) a:hover:not(.button)'), 'declarations' => array('color' => $color))); } // Header Bottom Background Color $setting = 'header_bottom_bg_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.bottom_header_wrap, .bottom_header_wrap nav, .bottom_header_wrap .top-bar-section li:not(.has-form) a:not(.button), .bottom_header_wrap .top-bar-section .dropdown li:not(.has-form) a:not(.button), .bottom_header_wrap .top-bar-section ul, .bottom_header_wrap .top-bar.expanded .title-area, .top-bar-section .dropdown li:hover:not(.has-form):not(.active) > a:not(.button), .top-bar-section li.active:not(.has-form) a:hover:not(.button)'), 'declarations' => array('background' => $color))); } // Bottom Header Navigation Link Color $setting = 'header_bottom_nav_link_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.bottom_header_wrap .bottom_nav a, .top-bar-section li.active:not(.has-form) a:not(.button)'), 'declarations' => array('color' => $color))); } // Header Font $setting = 'primary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('h1,h2,h3,h4,h5,h6,h1 a,h2 a,h3 a,h4 a,h5 a,h6 a'), 'declarations' => array('font-family' => $stack))); } // Header Font Color $setting = 'primary-font-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $color = sanitize_hex_color($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, .inner_sidebar .widget-title, .inner_sidebar .widget p .widget-title, footer.entry_meta .post_details, footer.entry_meta .share_title, .comment-respond h3'), 'declarations' => array('color' => $color))); } // Paragraph Font $setting = 'secondary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('body, p, blockquote, .format-link, p, pre, address, small, abbr, code, kbd, samp, small, var, form, legend, label, caption, .textwidget,.top-bar-section ul li > a, button, .button, .rescue-button span.rescue-button-inner, ol.vcalendar .duration, ol.vcalendar .vcard'), 'declarations' => array('font-family' => $stack))); } // Home Top Widgets Background Color $setting = 'home_top_widgets_bg'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.home_top_bg, .home_top_wrap, .inner_sidebar #mc_signup, .footer_widget #mc_signup'), 'declarations' => array('background-color' => $color))); } // Home Top Widgets Hover Color $setting = 'home_top_widgets_hover'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.home_widgets_top .icon_hover:hover i, .home_widgets_top .icon_hover:hover h3, .home_widgets_top .icon_hover:hover a'), 'declarations' => array('color' => $color))); } // Footer Background Color $setting = 'footer_bg_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('footer#site_footer'), 'declarations' => array('background-color' => $color))); } // Social Icons Color $setting = 'footer_social_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.footer_social a'), 'declarations' => array('color' => $color))); } // Social Icons Color Hover $setting = 'footer_social_color_hover'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.footer_social a:hover'), 'declarations' => array('color' => $color))); } }
/** * Inline script will load the full screen background image after all other images * on the page have loaded. */ function politics_basic_backstretch_inline_script() { if (is_page_template('front-page-template.php')) { ?> <script> jQuery( window ).load( function() { jQuery(".page-template-front-page-template .home-header-bg").backstretch([ <?php /** * Get our customizer options variables. */ $home_duration = get_theme_mod('home_duration', customizer_library_get_default('home_duration')); $home_fade = get_theme_mod('home_fade', customizer_library_get_default('home_fade')); $headers = get_uploaded_header_images(); /** * Display demo image if custom images haven't been uploaded yet */ if (empty($headers)) { $demoimage = get_template_directory_uri() . '/img/hero-bg.jpg'; ?> "<?php echo esc_url($demoimage); ?> ", <?php } else { /** * Loop through header images */ foreach ($headers as $header) { ?> "<?php echo $header['url']; ?> ", <?php } } ?> ], {duration: <?php echo esc_html($home_duration); ?> , fade: <?php echo esc_html($home_fade); ?> }); }); </script> <?php } // end is_front_page ?> <?php }
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function customizer_library_mystore_build_styles() { // Header Background Color $setting = 'mystore-header-bg-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.site-header.mystore-header-layout-standard, .site-header.mystore-header-layout-standard .search-block'), 'declarations' => array('background-color' => $color))); } // Primary Color $setting = 'mystore-primary-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('#comments .form-submit #submit, .search-block .search-submit, .no-results-btn, button, input[type="button"], input[type="reset"], input[type="submit"], .woocommerce ul.products li.product a.add_to_cart_button, .woocommerce-page ul.products li.product a.add_to_cart_button, .woocommerce ul.products li.product .onsale, .woocommerce-page ul.products li.product .onsale, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt:hover, .woocommerce-page #content input.button.alt:hover, .woocommerce .cart-collaterals .shipping_calculator .button, .woocommerce-page .cart-collaterals .shipping_calculator .button, .woocommerce a.button, .woocommerce-page a.button, .woocommerce input.button, .woocommerce-page #content input.button, .woocommerce-page input.button, .woocommerce #review_form #respond .form-submit input, .woocommerce-page #review_form #respond .form-submit input, .woocommerce-cart .wc-proceed-to-checkout a.checkout-button, .single-product span.onsale, .main-navigation ul ul a:hover, .main-navigation ul ul li.current-menu-item > a, .main-navigation ul ul li.current_page_item > a, .main-navigation ul ul li.current-menu-parent > a, .main-navigation ul ul li.current_page_parent > a, .main-navigation ul ul li.current-menu-ancestor > a, .main-navigation ul ul li.current_page_ancestor > a, .main-navigation button, .wpcf7-submit'), 'declarations' => array('background' => 'inherit', 'background-color' => $color))); } $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.content-area .entry-content a, #comments a, .search-btn, .post-edit-link, .site-title a, .error-404.not-found .page-header .page-title span, .search-button .fa-search, .header-cart-checkout.cart-has-items .fa-shopping-cart'), 'declarations' => array('color' => $color . ' !important'))); } // Secondary Color $setting = 'mystore-secondary-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.main-navigation button:hover, #comments .form-submit #submit:hover, .search-block .search-submit:hover, .no-results-btn:hover, button, input[type="button"], input[type="reset"], input[type="submit"], .woocommerce input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce .cart-collaterals .shipping_calculator .button, .woocommerce-page .cart-collaterals .shipping_calculator .button, .woocommerce a.button:hover, .woocommerce-page a.button:hover, .woocommerce input.button:hover, .woocommerce-page #content input.button:hover, .woocommerce-page input.button:hover, .woocommerce ul.products li.product a.add_to_cart_button:hover, .woocommerce-page ul.products li.product a.add_to_cart_button:hover, .woocommerce button.button.alt:hover, .woocommerce-page button.button.alt:hover, .woocommerce #review_form #respond .form-submit input:hover, .woocommerce-page #review_form #respond .form-submit input:hover, .woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover, .wpcf7-submit:hover'), 'declarations' => array('background' => 'inherit', 'background-color' => $color))); } $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('a:hover, .widget-area .widget a:hover, .site-footer-widgets .widget a:hover, .search-btn:hover, .search-button .fa-search:hover, .woocommerce #content div.product p.price, .woocommerce-page #content div.product p.price, .woocommerce-page div.product p.price, .woocommerce #content div.product span.price, .woocommerce div.product span.price, .woocommerce-page #content div.product span.price, .woocommerce-page div.product span.price, .woocommerce #content div.product .woocommerce-tabs ul.tabs li.active, .woocommerce div.product .woocommerce-tabs ul.tabs li.active, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li.active, .woocommerce-page div.product .woocommerce-tabs ul.tabs li.active'), 'declarations' => array('color' => $color))); } // Site Border Color $setting = 'mystore-site-border'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.site-border-top, .site-border-bottom, .site-border-left, .site-border-right'), 'declarations' => array('background-color' => $color))); } // Body Font $setting = 'mystore-body-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('body, .widget-area .widget a'), 'declarations' => array('font-family' => $stack))); } // Body Font Color $setting = 'mystore-body-font-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('body, .widget-area .widget a'), 'declarations' => array('color' => $color))); } // Heading Font $setting = 'mystore-heading-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .widget-area .widget-title, .woocommerce table.cart th, .woocommerce-page #content table.cart th, .woocommerce-page table.cart th, .woocommerce input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce table.cart input, .woocommerce-page #content table.cart input, .woocommerce-page table.cart input, button, input[type="button"], input[type="reset"], input[type="submit"]'), 'declarations' => array('font-family' => $stack))); } // Heading Font Color $setting = 'mystore-heading-font-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .widget-area .widget-title'), 'declarations' => array('color' => $color))); } }
?> <h1 class="page-header-title"> <?php echo wp_kses($politics_blog_title, array('strong' => array(), 'a' => array('href'))); ?> </h1><!-- .page-header-title --> <?php } // end politics_blog_title ?> <?php // Get the blog page subtitle $politics_blog_subtitle = get_theme_mod('politics_blog_subtitle', customizer_library_get_default('politics_blog_subtitle')); if ($politics_blog_subtitle) { ?> <h2 class="page-header-subtitle"> <?php echo wp_kses($politics_blog_subtitle, array('strong' => array(), 'a' => array('href'))); ?> </h2><!-- .page-header-subtitle --> <?php } // end politics_blog_subtitle ?> </div><!-- .blog_page_header -->
</div><!-- .large-9 --> </div><!-- .row --> </div><!-- .mini-header --> </header><!-- .mini-header-wrap --> <header id="masthead" class="site-header" role="banner"> <div class="row"> <div class="large-12 columns"> <div class="site-branding"> <?php $politics_logo = get_theme_mod('politics-logo', customizer_library_get_default('politics-logo')); if ($politics_logo) { ?> <a href="<?php echo esc_url(home_url('/')); ?> " rel="home"> <img src="<?php echo esc_url($politics_logo); ?> " alt="<?php echo esc_attr(get_bloginfo('name')); ?> "> </a>
<div class="large-12 columns"> <?php $home_secondary_content_title = get_theme_mod('home_secondary_content_title', customizer_library_get_default('home_secondary_content_title')); if ($home_secondary_content_title) { ?> <h2><?php echo esc_attr($home_secondary_content_title); ?> </h2> <?php } // end home_posts_title $home_secondary_content_subtitle = get_theme_mod('home_secondary_content_subtitle', customizer_library_get_default('home_secondary_content_subtitle')); if ($home_secondary_content_subtitle) { ?> <p><?php echo esc_attr($home_secondary_content_subtitle); ?> </p> <?php } // end home_posts_section_subtitle ?> </div><!-- .large-12 -->
// Reset the Query Loop ?> </ul><!-- .small-block-grid-2 medium-block-grid-3 large-block-grid-3 --> </div><!-- .row .home_image_gallery --> <div class="row home-gallery-button-section"> <div class="medium-12 columns home_gallery_button"> <a href="<?php echo esc_attr(get_theme_mod('home_gallery_link')); ?> " class="button tiny radius right"> <?php printf(__('%s', 'rescue'), esc_attr(get_theme_mod('home_gallery_button_text', customizer_library_get_default('home_gallery_button_text')))); ?> </a> </div><!-- .medium-12 .home_gallery_button --> </div><!-- .row --> </div><!-- .clearfix .home_image_gallery --> <?php } // end our plugin check ?> <?php }
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function customizer_library_xcel_build_styles() { // Main Color $color = 'xcel-setting-main-color'; $titlecolor = 'xcel-setting-title-color'; $titlefontcolor = 'xcel-setting-title-font-color'; $colormod = get_theme_mod($color, customizer_library_get_default($color)); $titlecolormod = get_theme_mod($titlecolor, customizer_library_get_default($titlecolor)); $titlefontcolormod = get_theme_mod($titlefontcolor, customizer_library_get_default($titlefontcolor)); $bgcolormod = get_theme_mod($color, customizer_library_get_default($color)); $bghardcolormod = get_theme_mod($color, customizer_library_get_default($color)); $bgbordercolormod = get_theme_mod($color, customizer_library_get_default($color)); if ($colormod !== customizer_library_get_default($color)) { $sancolor = sanitize_hex_color($colormod); Customizer_Library_Styles()->add(array('selectors' => array('a, .search-btn, .error-404.not-found .page-header .page-title span, .search-button .fa-search'), 'declarations' => array('color' => $sancolor))); } if ($bgcolormod !== customizer_library_get_default($color)) { $bgsancolor = sanitize_hex_color($bgcolormod); Customizer_Library_Styles()->add(array('selectors' => array('#comments .form-submit #submit, .search-block .search-submit, .no-results-btn, button, input[type="button"], input[type="reset"], input[type="submit"], .woocommerce ul.products li.product a.add_to_cart_button, .woocommerce-page ul.products li.product a.add_to_cart_button, .woocommerce ul.products li.product .onsale, .woocommerce-page ul.products li.product .onsale, .woocommerce span.onsale, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt:hover, .woocommerce-page #content input.button.alt:hover, .woocommerce .cart-collaterals .shipping_calculator .button, .woocommerce-page .cart-collaterals .shipping_calculator .button, .woocommerce a.button, .woocommerce-page a.button, .woocommerce input.button, .woocommerce-page #content input.button, .woocommerce-page input.button, .woocommerce #review_form #respond .form-submit input, .woocommerce-page #review_form #respond .form-submit input, .woocommerce .site-header, .woocommerce-page .site-header, .woocommerce-cart .wc-proceed-to-checkout a.checkout-button, .header-cart:hover .header-cart-checkout .fa, .main-navigation button, .wpcf7-submit'), 'declarations' => array('background' => 'inherit', 'background-color' => $bgsancolor))); } if ($titlecolormod !== customizer_library_get_default($titlecolor)) { $titlesancolor = sanitize_hex_color($titlecolormod); Customizer_Library_Styles()->add(array('selectors' => array('.page-titlebar'), 'declarations' => array('background' => 'inherit', 'background-color' => $titlesancolor))); } if ($titlefontcolormod !== customizer_library_get_default($titlefontcolor)) { $titlefontsancolor = sanitize_hex_color($titlefontcolormod); Customizer_Library_Styles()->add(array('selectors' => array('.page-titlebar-left .entry-title, .page-titlebar-right, .page-titlebar-right a'), 'declarations' => array('color' => $titlefontsancolor))); } if ($bghardcolormod !== customizer_library_get_default($color)) { $bghardsancolor = sanitize_hex_color($bghardcolormod); Customizer_Library_Styles()->add(array('selectors' => array('.header-cart-checkout.cart-has-items .fa-shopping-cart'), 'declarations' => array('background-color' => $bghardsancolor . ' !important'))); } if ($bgbordercolormod !== customizer_library_get_default($color)) { $bgbordersancolor = sanitize_hex_color($bgbordercolormod); Customizer_Library_Styles()->add(array('selectors' => array('.woocommerce ul.products li.product .onsale:after, .woocommerce-page ul.products li.product .onsale:after'), 'declarations' => array('border-right' => '4px solid ' . $bgbordersancolor))); } // Main Color Hover $colorh = 'xcel-setting-main-color-hover'; $colorhmod = get_theme_mod($colorh, customizer_library_get_default($colorh)); $bgcolorhmod = get_theme_mod($colorh, customizer_library_get_default($colorh)); if ($colorhmod !== customizer_library_get_default($colorh)) { $sancolorh = sanitize_hex_color($colorhmod); Customizer_Library_Styles()->add(array('selectors' => array('a:hover, .widget-area .widget a:hover, .site-footer-widgets a:hover, .search-btn:hover, .search-button .fa-search:hover, .woocommerce #content div.product p.price, .woocommerce-page #content div.product p.price, .woocommerce-page div.product p.price, .woocommerce #content div.product span.price, .woocommerce div.product span.price, .woocommerce-page #content div.product span.price, .woocommerce-page div.product span.price, .woocommerce #content div.product .woocommerce-tabs ul.tabs li.active, .woocommerce div.product .woocommerce-tabs ul.tabs li.active, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li.active, .woocommerce-page div.product .woocommerce-tabs ul.tabs li.active'), 'declarations' => array('color' => $sancolorh))); } if ($bgcolorhmod !== customizer_library_get_default($colorh)) { $bgsancolorh = sanitize_hex_color($bgcolorhmod); Customizer_Library_Styles()->add(array('selectors' => array('.main-navigation button:hover, #comments .form-submit #submit:hover, .search-block .search-submit:hover, .no-results-btn:hover, button, input[type="button"], input[type="reset"], input[type="submit"], .woocommerce input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce .cart-collaterals .shipping_calculator .button, .woocommerce-page .cart-collaterals .shipping_calculator .button, .woocommerce a.button:hover, .woocommerce-page a.button:hover, .woocommerce input.button:hover, .woocommerce-page #content input.button:hover, .woocommerce-page input.button:hover, .woocommerce ul.products li.product a.add_to_cart_button:hover, .woocommerce-page ul.products li.product a.add_to_cart_button:hover, .woocommerce button.button.alt:hover, .woocommerce-page button.button.alt:hover, .woocommerce #review_form #respond .form-submit input:hover, .woocommerce-page #review_form #respond .form-submit input:hover, .woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover, .wpcf7-submit:hover'), 'declarations' => array('background' => 'inherit', 'background-color' => $bgsancolorh))); } // Body Font $font = 'xcel-setting-body-font'; $fontmod = get_theme_mod($font, customizer_library_get_default($font)); $fontstack = customizer_library_get_font_stack($fontmod); $fontcolor = 'xcel-setting-body-font-color'; $fontcolormod = get_theme_mod($fontcolor, customizer_library_get_default($fontcolor)); if ($fontmod != customizer_library_get_default($font)) { Customizer_Library_Styles()->add(array('selectors' => array('body'), 'declarations' => array('font-family' => $fontstack))); } if ($fontcolormod !== customizer_library_get_default($fontcolor)) { $sanfontcolor = sanitize_hex_color($fontcolormod); Customizer_Library_Styles()->add(array('selectors' => array('body, .widget-area .widget a, .site-footer-widgets a'), 'declarations' => array('color' => $sanfontcolor))); } // Heading Font $hfont = 'xcel-setting-heading-font'; $hfontmod = get_theme_mod($hfont, customizer_library_get_default($hfont)); $hfontstack = customizer_library_get_font_stack($hfontmod); $hfontcolor = 'xcel-setting-heading-font-color'; $hfontcolormod = get_theme_mod($hfontcolor, customizer_library_get_default($hfontcolor)); if ($hfontmod != customizer_library_get_default($hfont)) { Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .woocommerce table.cart th, .woocommerce-page #content table.cart th, .woocommerce-page table.cart th, .woocommerce input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce table.cart input, .woocommerce-page #content table.cart input, .woocommerce-page table.cart input, button, input[type="button"], input[type="reset"], input[type="submit"]'), 'declarations' => array('font-family' => $hfontstack))); } if ($hfontcolormod !== customizer_library_get_default($hfontcolor)) { $sanhfontcolor = sanitize_hex_color($hfontcolormod); Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a'), 'declarations' => array('color' => $sanhfontcolor))); } }
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function customizer_library_oceanic_build_styles() { // Main Color $color = 'oceanic-main-color'; $colormod = get_theme_mod($color, customizer_library_get_default($color)); $bgcolormod = get_theme_mod($color, customizer_library_get_default($color)); $bghardcolormod = get_theme_mod($color, customizer_library_get_default($color)); $bgbordercolormod = get_theme_mod($color, customizer_library_get_default($color)); if ($colormod !== customizer_library_get_default($color)) { $sancolor = esc_html($colormod); Customizer_Library_Styles()->add(array('selectors' => array('a, .search-btn, .site-title a, .error-404.not-found .page-header .page-title span, .search-button .fa-search, .widget-area .widget a, .site-top-bar-left-text em, color-text'), 'declarations' => array('color' => $sancolor))); } if ($bgbordercolormod !== customizer_library_get_default($color)) { $sancolor = esc_html($bgbordercolormod); Customizer_Library_Styles()->add(array('selectors' => array('input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, textarea:focus'), 'declarations' => array('border-color' => $sancolor))); } if ($bgcolormod !== customizer_library_get_default($color)) { $bgsancolor = esc_html($bgcolormod); Customizer_Library_Styles()->add(array('selectors' => array('#comments .form-submit #submit, .search-block .search-submit, .no-results-btn, button, input[type="button"], input[type="reset"], input[type="submit"], .home-slider-prev:hover, .home-slider-next:hover, .woocommerce ul.products li.product a.add_to_cart_button, .woocommerce-page ul.products li.product a.add_to_cart_button, .woocommerce ul.products li.product .onsale, .woocommerce-page ul.products li.product .onsale, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt:hover, .woocommerce-page #content input.button.alt:hover, .woocommerce .cart-collaterals .shipping_calculator .button, .woocommerce-page .cart-collaterals .shipping_calculator .button, .woocommerce a.button, .woocommerce-page a.button, .woocommerce input.button, .woocommerce-page #content input.button, .woocommerce-page input.button, .woocommerce #review_form #respond .form-submit input, .woocommerce-page #review_form #respond .form-submit input, .header-cart:hover .header-cart-checkout .fa, .main-navigation a:hover, .main-navigation li.current-menu-item > a, .main-navigation li.current_page_item > a, .main-navigation li.current-menu-parent > a, .main-navigation li.current_page_parent > a, .main-navigation li.current-menu-ancestor > a, .main-navigation li.current_page_ancestor > a, .main-navigation button, .wpcf7-submit'), 'declarations' => array('background' => 'inherit', 'background-color' => $bgsancolor))); } if ($bghardcolormod !== customizer_library_get_default($color)) { $bghardsancolor = esc_html($bghardcolormod); Customizer_Library_Styles()->add(array('selectors' => array('.header-cart-checkout.cart-has-items .fa-shopping-cart'), 'declarations' => array('background-color' => $bghardsancolor . ' !important'))); } if ($bgbordercolormod !== customizer_library_get_default($color)) { $bgbordersancolor = esc_html($bgbordercolormod); Customizer_Library_Styles()->add(array('selectors' => array('.woocommerce ul.products li.product .onsale:after, .woocommerce-page ul.products li.product .onsale:after'), 'declarations' => array('border-right' => '4px solid ' . $bgbordersancolor))); } if ($bgbordercolormod !== customizer_library_get_default($color)) { $bgbordersancolor = esc_html($bgbordercolormod); Customizer_Library_Styles()->add(array('selectors' => array('.woocommerce .woocommerce-message'), 'declarations' => array('border-top-color' => $bgbordersancolor))); } // Main Color Hover $colorh = 'oceanic-main-color-hover'; $colorhmod = get_theme_mod($colorh, customizer_library_get_default($colorh)); $bgcolorhmod = get_theme_mod($colorh, customizer_library_get_default($colorh)); if ($colorhmod !== customizer_library_get_default($colorh)) { $sancolorh = esc_html($colorhmod); Customizer_Library_Styles()->add(array('selectors' => array('a:hover, .widget-area .widget a:hover, .site-footer-widgets .widget a:hover, .site-footer-bottom-bar a:hover, .search-btn:hover, .search-button .fa-search:hover, .woocommerce #content div.product p.price, .woocommerce-page #content div.product p.price, .woocommerce-page div.product p.price, .woocommerce #content div.product span.price, .woocommerce div.product span.price, .woocommerce-page #content div.product span.price, .woocommerce-page div.product span.price, .woocommerce #content div.product .woocommerce-tabs ul.tabs li.active, .woocommerce div.product .woocommerce-tabs ul.tabs li.active, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li.active, .woocommerce-page div.product .woocommerce-tabs ul.tabs li.active, .oceanic-header-layout-standard .site-header-right a:hover'), 'declarations' => array('color' => $sancolorh))); } if ($bgcolorhmod !== customizer_library_get_default($colorh)) { $bgsancolorh = esc_html($bgcolorhmod); Customizer_Library_Styles()->add(array('selectors' => array('.main-navigation button:hover, #comments .form-submit #submit:hover, .search-block .search-submit:hover, .no-results-btn:hover, button:hover, input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover, .woocommerce input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce .cart-collaterals .shipping_calculator .button, .woocommerce-page .cart-collaterals .shipping_calculator .button, .woocommerce a.button:hover, .woocommerce-page a.button:hover, .woocommerce input.button:hover, .woocommerce-page #content input.button:hover, .woocommerce-page input.button:hover, .woocommerce ul.products li.product a.add_to_cart_button:hover, .woocommerce-page ul.products li.product a.add_to_cart_button:hover, .woocommerce button.button.alt:hover, .woocommerce-page button.button.alt:hover, .woocommerce #review_form #respond .form-submit input:hover, .woocommerce-page #review_form #respond .form-submit input:hover, wpcf7-submit:hover'), 'declarations' => array('background' => 'inherit', 'background-color' => $bgsancolorh))); } // Body Font $font = 'oceanic-body-font'; $fontmod = get_theme_mod($font, customizer_library_get_default($font)); $fontstack = customizer_library_get_font_stack($fontmod); $fontcolor = 'oceanic-body-font-color'; $fontcolormod = get_theme_mod($fontcolor, customizer_library_get_default($fontcolor)); if ($fontmod != customizer_library_get_default($font)) { Customizer_Library_Styles()->add(array('selectors' => array('body, .site-footer-widgets .widget a, .site-footer-bottom-bar a'), 'declarations' => array('font-family' => $fontstack))); } if ($fontcolormod !== customizer_library_get_default($fontcolor)) { $sanfontcolor = esc_html($fontcolormod); Customizer_Library_Styles()->add(array('selectors' => array('body, .site-footer-widgets .widget a, .site-footer-bottom-bar a'), 'declarations' => array('color' => $sanfontcolor))); } // Heading Font $hfont = 'oceanic-heading-font'; $hfontmod = get_theme_mod($hfont, customizer_library_get_default($hfont)); $hfontstack = customizer_library_get_font_stack($hfontmod); $hfontcolor = 'oceanic-heading-font-color'; $hfontcolormod = get_theme_mod($hfontcolor, customizer_library_get_default($hfontcolor)); if ($hfontmod != customizer_library_get_default($hfont)) { Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, .woocommerce table.cart th, .woocommerce-page #content table.cart th, .woocommerce-page table.cart th, .woocommerce input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce table.cart input, .woocommerce-page #content table.cart input, .woocommerce-page table.cart input, button, input[type="button"], input[type="reset"], input[type="submit"]'), 'declarations' => array('font-family' => $hfontstack))); } if ($hfontcolormod !== customizer_library_get_default($hfontcolor)) { $sanhfontcolor = esc_html($hfontcolormod); Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a'), 'declarations' => array('color' => $sanhfontcolor))); } }
/** * Generates the style tag and CSS needed for the theme options. * * By using the "Customizer_Library_Styles" filter, different components can print CSS in the header. * It is organized this way to ensure there is only one "style" tag. * * @since 1.0.0. * * @return void */ function customizer_library_demo_styles() { do_action('customizer_library_styles'); echo "\n<!-- Begin Custom CSS -->\n<style type=\"text/css\" id=\"politics-custom-css\">\n"; $politics_plug_logo_height = get_theme_mod('politics-logo-height', customizer_library_get_default('politics-logo-height')); $politics_logo_width = get_theme_mod('politics-logo-width', customizer_library_get_default('politics-logo-width')); if ($politics_plug_logo_height || $politics_logo_width) { ?> .site-branding img { height: <?php echo esc_attr($politics_plug_logo_height); ?> ; width: <?php echo esc_attr($politics_logo_width); ?> ; } <?php } $home_paralax_bg = get_theme_mod('home_paralax_bg', customizer_library_get_default('home_paralax_bg')); $home_paralax_bg_color = get_theme_mod('home_paralax_bg_color', customizer_library_get_default('home_paralax_bg_color')); ?> .home .home_paralax::before { background-color: <?php echo esc_attr($home_paralax_bg_color); ?> ; background: url('<?php echo esc_url($home_paralax_bg); ?> ') no-repeat center center; background-size: cover; } <?php // Echo the rules $css = Customizer_Library_Styles()->build(); if (!empty($css)) { echo $css; } echo "\n</style>\n<!-- End Custom CSS -->\n"; }
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function customizer_library_squarely_build_styles() { // Primary Color $setting = 'header-hero'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.section-hero'), 'declarations' => array('background-image' => 'url(' . $mod . ')'))); } $setting = 'brand-primary'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.primary-bg', '.btn-primary', '.icon-btn-primary', '.fbox-icon i:hover', '.fbox-icon i', '.br-primary'), 'declarations' => array('background-color' => $color, 'border-color' => $color))); Customizer_Library_Styles()->add(array('selectors' => array('.text-primary', '.c-primary', '.btn-primary-outline', 'icon-btn-primary-outline', '.btn-link', '.border-sm-primary', 'a', '.nav-link', '.social-icons', '.navbar-brand'), 'declarations' => array('color' => $color, 'border-color' => $color))); } // Secondary Color $setting = 'brand-secondary'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.secondary-bg', '.btn-secondary', '.icon-btn-secondary'), 'declarations' => array('background-color' => $color, 'border' => $color))); $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.secondary'), 'declarations' => array('color' => $color, 'border' => $color))); } // Success Color $setting = 'brand-success'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.success-bg', '.bg-success', '.btn-success', '.icon-btn-success'), 'declarations' => array('background-color' => $color, 'border-color' => $color))); Customizer_Library_Styles()->add(array('selectors' => array('.c-success', '.text-success', '.btn-success-outline', '.icon-btn-success-outline', '.success-outline'), 'declarations' => array('color' => $color, 'border-color' => $color))); } // Success Color $setting = 'brand-info'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.info-bg', '.bg-info', '.btn-info', '.icon-btn-info'), 'declarations' => array('background-color' => $color, 'border-color' => $color))); Customizer_Library_Styles()->add(array('selectors' => array('.c-info', '.text-info', '.btn-info-outline', '.icon-btn-info-outline'), 'declarations' => array('color' => $color, 'border-color' => $color))); } // Border Color $setting = 'body-color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod !== customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('body', '.c-gray'), 'declarations' => array('color' => $color))); } // Primary Font $setting = 'primary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'a', 'li', 'body'), 'declarations' => array('font-family' => $stack))); } // Secondary Font $setting = 'secondary-font'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); $stack = customizer_library_get_font_stack($mod); if ($mod != customizer_library_get_default($setting)) { Customizer_Library_Styles()->add(array('selectors' => array('.script'), 'declarations' => array('font-family' => $stack))); } $setting = 'body_font_color'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod != customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('body'), 'declarations' => array('color' => $color))); } $setting = 'body_background'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod != customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('body'), 'declarations' => array('background-color' => $color))); } $setting = 'nav-background'; $mod = get_theme_mod($setting, customizer_library_get_default($setting)); if ($mod != customizer_library_get_default($setting)) { $color = sanitize_hex_color($mod); Customizer_Library_Styles()->add(array('selectors' => array('.navbar-custom'), 'declarations' => array('background-color' => $color))); } }
/** * Process user options to generate CSS needed to implement the choices. * * @since 1.0.0. * * @return void */ function customizer_library_kaira_build_styles() { // Main Color $color = 'kra-main-color'; $colormod = get_theme_mod($color, customizer_library_get_default($color)); $bgcolormod = get_theme_mod($color, customizer_library_get_default($color)); $border_top_colormod = get_theme_mod($color, customizer_library_get_default($color)); $border_right_colormod = get_theme_mod($color, customizer_library_get_default($color)); if ($colormod !== customizer_library_get_default($color)) { $sancolor = sanitize_hex_color($colormod); Customizer_Library_Styles()->add(array('selectors' => array('a, .pc-text a, .search-block i, .search-no-results .page-title, .archive .page-title span, .search-results .page-title span, .entry-title, .entry-title a, .entry-content a, .entry-footer a, .search-button .fa-search, .error404 .page-title, .error404 .page-content .widgettitle, .widget ul li a, .main-navigation a'), 'declarations' => array('color' => $sancolor))); } if ($bgcolormod !== customizer_library_get_default($color)) { $bgsancolor = sanitize_hex_color($bgcolormod); Customizer_Library_Styles()->add(array('selectors' => array('.site-header-search .search-submit, .no-site-header-img .site-header-cover-image, .tags-links a, .form-submit #submit, .wpcf7-submit, .woocommerce ul.products li.product a, .woocommerce-page ul.products li.product a, .woocommerce input.button.alt:hover, .woocommerce-page #content input.button.alt:hover'), 'declarations' => array('background-color' => $bgsancolor . ' !important'))); } if ($border_top_colormod !== customizer_library_get_default($color)) { $border_top_sancolor = sanitize_hex_color($border_top_colormod); Customizer_Library_Styles()->add(array('selectors' => array('.color-border-top, .nav-links a, aside.widget, .archive .page-header, article.page.blog-post-side-layout, article.post.blog-post-side-layout, .woocommerce #container, .woocommerce-page #container, .woocommerce-page .content-area, .page #content .content-area'), 'declarations' => array('border-top' => '6px solid ' . $border_top_sancolor))); } if ($border_right_colormod !== customizer_library_get_default($color)) { $border_right_sancolor = sanitize_hex_color($border_right_colormod); Customizer_Library_Styles()->add(array('selectors' => array('.tags-links a:after'), 'declarations' => array('border-right' => '12px solid ' . $border_right_sancolor))); } // Main Color Hover $colorh = 'kra-main-color-hover'; $colorhmod = get_theme_mod($colorh, customizer_library_get_default($colorh)); $bgcolorhmod = get_theme_mod($colorh, customizer_library_get_default($colorh)); if ($colorhmod !== customizer_library_get_default($colorh)) { $sancolorh = sanitize_hex_color($colorhmod); Customizer_Library_Styles()->add(array('selectors' => array('a:hover, .pc-text a:hover, .search-block i:hover, .entry-content a:hover, .entry-footer a:hover, .search-button .fa-search:hover, .widget ul li a:hover, .main-navigation a:hover'), 'declarations' => array('color' => $sancolorh))); } if ($bgcolorhmod !== customizer_library_get_default($colorh)) { $bgsancolorh = sanitize_hex_color($bgcolorhmod); Customizer_Library_Styles()->add(array('selectors' => array('.form-submit #submit:hover, .wpcf7-submit:hover, .woocommerce ul.products li.product .add_to_cart_button:hover, .woocommerce-page ul.products li.product .add_to_cart_button:hover, .site-header-search .search-submit:hover, .woocommerce input.button.alt, .woocommerce-page #content input.button.alt'), 'declarations' => array('background-color' => $bgsancolorh . ' !important'))); } // Body Font $font = 'kra-body-font'; $fontmod = get_theme_mod($font, customizer_library_get_default($font)); $fontstack = customizer_library_get_font_stack($fontmod); $fontcolor = 'kra-body-font-color'; $fontcolormod = get_theme_mod($fontcolor, customizer_library_get_default($fontcolor)); if ($fontmod != customizer_library_get_default($font)) { Customizer_Library_Styles()->add(array('selectors' => array('body, .page-header h1, .alba-banner-heading h5, .alba-carousel-block, .alba-heading-text'), 'declarations' => array('font-family' => $fontstack))); } if ($fontcolormod !== customizer_library_get_default($fontcolor)) { $sanfontcolor = sanitize_hex_color($fontcolormod); Customizer_Library_Styles()->add(array('selectors' => array('body, .page-header h1, .alba-banner-heading h5, .alba-carousel-block, .alba-heading-text'), 'declarations' => array('color' => $sanfontcolor))); } // Heading Font $hfont = 'kra-heading-font'; $hfontmod = get_theme_mod($hfont, customizer_library_get_default($hfont)); $hfontstack = customizer_library_get_font_stack($hfontmod); $hfontcolor = 'kra-heading-font-color'; $hfontcolormod = get_theme_mod($hfontcolor, customizer_library_get_default($hfontcolor)); if ($hfontmod != customizer_library_get_default($hfont)) { Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a'), 'declarations' => array('font-family' => $hfontstack))); } if ($hfontcolormod !== customizer_library_get_default($hfontcolor)) { $sanhfontcolor = sanitize_hex_color($hfontcolormod); Customizer_Library_Styles()->add(array('selectors' => array('h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a'), 'declarations' => array('color' => $sanhfontcolor))); } }