Exemplo n.º 1
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)
     */
    public static function header_output()
    {
        // customizer settings
        $theme_mods = get_theme_mod('carpress');
        ?>
		<!--Customizer CSS-->
		<style type="text/css">

		/******************
		Default theme color
		*******************/
		<?php 
        if (!empty($theme_mods['theme_clr'])) {
            ?>
			a,
			.opening-time .time-table .opening-time--title,
			.theme-clr,
			.navbar .nav > li a:hover,
			.navbar .nav > li.active > a:hover,
			.dropdown-menu > li > a:hover,
			.submenu-languages > li > a:hover,
			.opening-time .week-day.today dt,
			.sidebar-item.widget_nav_menu .nav-pills > li > a:hover,
			.lined .meta-data a,
			.table tbody .active td,
			.foot a.tweet_user,
			.foot a.read-more,
			.foot .nav a:hover,
			.navbar-inverse .nav-collapse .nav > li > a:hover:hover,
			.opening-time .time-table > .additional-info,
			.sidebar-item.widget_nav_menu .nav-pills .dropdown-menu > li > a:hover {
				color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
			}

			.navbar .nav > li.dropdown:hover > .dropdown-toggle,
			a:hover {
				color: <?php 
            echo darken_css_color($theme_mods['theme_clr'], 15);
            ?>
;
			}

			.navbar .nav > li.active > a,
			.navbar .nav > li.active:after {
				border-bottom-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
			}

			.navbar .nav > li.dropdown.open > a:after,
			.navbar .nav > li.dropdown.active > a:after,
			.navbar .nav > li.dropdown.open.active > a:after,
			.navbar .nav > li.dropdown:hover > a:after {
				border-top-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
			}

			.breadcrumbs-container .divider {
				border-left-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
			}

			.nav-collapse .dropdown-menu,
			.nav-collapse .submenu-languages,
			#wp-calendar caption,
			.accordion-heading.open a .icon,
			.tap-to-call {
				background-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
			}

			select:focus,
			textarea:focus,
			input[type="text"]:focus,
			input[type="password"]:focus,
			input[type="datetime"]:focus,
			input[type="datetime-local"]:focus,
			input[type="date"]:focus,
			input[type="month"]:focus,
			input[type="time"]:focus,
			input[type="week"]:focus,
			input[type="number"]:focus,
			input[type="email"]:focus,
			input[type="url"]:focus,
			input[type="search"]:focus,
			input[type="tel"]:focus,
			input[type="color"]:focus,
			.uneditable-input:focus {
				border-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
			}

			.table tbody .active {
				border-left-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
				border-right-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
			}

			.table tbody .active td {
				border-top-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
				border-bottom-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
			}

			.btn-featured:hover {
				background-color: <?php 
            echo darken_css_color($theme_mods['theme_clr'], 15);
            ?>
;
			}

			.foot {
				background-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
				border-top-color: <?php 
            echo darken_css_color($theme_mods['theme_clr'], 15);
            ?>
;
			}

			.arrows .fa-chevron-right:hover:hover,
			.arrows .fa-chevron-left:hover:hover,
			.foot #to-the-top,
			.jumbotron .bottom-widgets,
			.navbar-inverse .btn-navbar,
			.btn-featured {
				background-color: <?php 
            echo $theme_mods['theme_clr'];
            ?>
;
				background-image: -moz-linear-gradient(top, <?php 
            echo $theme_mods['theme_clr'];
            ?>
, <?php 
            echo darken_css_color($theme_mods['theme_clr'], 15);
            ?>
);
				background-image: -webkit-gradient(linear, 0 0, 0 100%, from(<?php 
            echo $theme_mods['theme_clr'];
            ?>
), to(<?php 
            echo darken_css_color($theme_mods['theme_clr'], 15);
            ?>
));
				background-image: -webkit-linear-gradient(top, <?php 
            echo $theme_mods['theme_clr'];
            ?>
, <?php 
            echo darken_css_color($theme_mods['theme_clr'], 15);
            ?>
);
				background-image: -o-linear-gradient(top, <?php 
            echo $theme_mods['theme_clr'];
            ?>
, <?php 
            echo darken_css_color($theme_mods['theme_clr'], 15);
            ?>
);
				background-image: linear-gradient(to bottom, <?php 
            echo $theme_mods['theme_clr'];
            ?>
, <?php 
            echo darken_css_color($theme_mods['theme_clr'], 15);
            ?>
);
			}

			/***********
			Button color
			************/
			<?php 
        }
        if (!empty($theme_mods['btn_clr'])) {
            ?>
			.btn-warning,
			.btn-theme,
			#comments-submit-button,
			.sidebar-item.widget_nav_menu .nav-pills > li.active > a,
			.sidebar-item.widget_nav_menu .nav-pills > li.active > a:hover,
			.sidebar-item.widget_nav_menu .nav-pills > li.current-menu-ancestor > a,
			.sidebar-item.widget_nav_menu .nav-pills > li.current-menu-ancestor > a:hover,
			.nav-tabs-theme > .active > a,
			.nav-tabs-theme > .active > a:hover,
			.pagination .page-numbers {
				background-color: <?php 
            echo $theme_mods['btn_clr'];
            ?>
;
				background-image: -moz-linear-gradient(top, <?php 
            echo $theme_mods['btn_clr'];
            ?>
, <?php 
            echo darken_css_color($theme_mods['btn_clr'], 15);
            ?>
);
				background-image: -webkit-gradient(linear, 0 0, 0 100%, from(<?php 
            echo $theme_mods['btn_clr'];
            ?>
), to(<?php 
            echo darken_css_color($theme_mods['btn_clr'], 15);
            ?>
));
				background-image: -webkit-linear-gradient(top, <?php 
            echo $theme_mods['btn_clr'];
            ?>
, <?php 
            echo darken_css_color($theme_mods['btn_clr'], 15);
            ?>
);
				background-image: -o-linear-gradient(top, <?php 
            echo $theme_mods['btn_clr'];
            ?>
, <?php 
            echo darken_css_color($theme_mods['btn_clr'], 15);
            ?>
);
				background-image: linear-gradient(to bottom, <?php 
            echo $theme_mods['btn_clr'];
            ?>
, <?php 
            echo darken_css_color($theme_mods['btn_clr'], 15);
            ?>
);
			}
			.opening-time .week-day.today dd,
			.opening-time .week-day.today dt {
				color: <?php 
            echo $theme_mods['btn_clr'];
            ?>
;
			}
			.btn-warning:hover,
			.btn-theme:hover,
			.btn-theme:active,
			.btn-theme.active,
			.btn-theme.disabled,
			.btn-theme[disabled],
			#comments-submit-button:hover,
			#comments-submit-button:active,
			#comments-submit-button.active {
				background-color: <?php 
            echo darken_css_color($theme_mods['btn_clr'], 15);
            ?>
;
				*background-color: <?php 
            echo darken_css_color($theme_mods['btn_clr'], 20);
            ?>
;
			}
			.btn-theme:active,
			.btn-theme.active,
			#comments-submit-button:active
			#comments-submit-button.active,
			.pagination .page-numbers.current {
				background-color: <?php 
            echo darken_css_color($theme_mods['btn_clr'], 25);
            ?>
;
			}

			/**************
			Base text color
			***************/
			<?php 
        }
        if (!empty($theme_mods['bodytext_clr'])) {
            ?>

			blockquote p,
			body {
				color: <?php 
            echo $theme_mods['bodytext_clr'];
            ?>
;
			}

	<?php 
        }
        if (!empty($theme_mods['titlearea_txt_clr'])) {
            ?>

			.title-area h1 {
				color: <?php 
            echo $theme_mods['titlearea_txt_clr'];
            ?>
;
			}


		<?php 
        }
        if (!empty($theme_mods['navbar_clr']) && '#000000' !== $theme_mods['navbar_clr']) {
            ?>

			.navbar .container {
				background: <?php 
            echo $theme_mods['navbar_clr'];
            ?>
;
			}

			.btn-featured:before {
				border-top-color: <?php 
            echo $theme_mods['navbar_clr'];
            ?>
;
			}



		<?php 
        }
        if (!empty($theme_mods['navbar_txt_clr'])) {
            ?>

			.navbar .nav > li a,
			.navbar .brand,
			.navbar .brand h1,
			.navbar .nav > li.dropdown.active > .dropdown-toggle {
				color: <?php 
            echo $theme_mods['navbar_txt_clr'];
            ?>
;
			}
			@media (max-width: 979px) {
				.navbar .nav > li a,
				.navbar-inverse .nav-collapse .nav > li > a,
				.navbar-inverse .nav-collapse .dropdown-menu a,
				.navbar-inverse .nav-collapse .submenu-languages a {
					color: <?php 
            echo $theme_mods['navbar_txt_clr'];
            ?>
;
				}
			}

		<?php 
        }
        if (!empty($theme_mods['footer_clr'])) {
            ?>

			.foot {
				background: <?php 
            echo $theme_mods['footer_clr'];
            ?>
;
			}

		<?php 
        }
        if (!empty($theme_mods['footer_txt_clr'])) {
            ?>

			.foot,
			.foot a,
			.foot .lined h2 {
				color: <?php 
            echo $theme_mods['footer_txt_clr'];
            ?>
 !important;
			}
			.foot .lined h5,
			.foot a:hover {
				color: <?php 
            echo darken_css_color($theme_mods['footer_txt_clr'], 33);
            ?>
  !important;
			}


			<?php 
        }
        $background_color = get_background_color();
        if (!empty($background_color)) {
            ?>
			.divide-line .icon {
				background-color: #<?php 
            echo $background_color;
            ?>
;
			}

		<?php 
        }
        $footer_pattern = get_theme_mod('footer_pattern_img');
        if (!empty($footer_pattern)) {
            ?>
			.foot {
				background-image: url('<?php 
            echo $footer_pattern;
            ?>
');
			}

		<?php 
        }
        $slider_bg_color = rgb_from_hexdec(get_theme_mod('front_carousel_bg', '#000000'));
        $slider_bg_opacity = get_theme_mod('front_carousel_opacity', '0.5');
        if (!empty($slider_bg_color)) {
            ?>
			.jumbotron .header-padding {
				background-color: rgba(<?php 
            echo $slider_bg_color[0];
            ?>
, <?php 
            echo $slider_bg_color[1];
            ?>
, <?php 
            echo $slider_bg_color[2];
            ?>
, <?php 
            echo $slider_bg_opacity;
            ?>
);
			}

		<?php 
        }
        $background_color = get_background_color();
        if (!empty($background_color)) {
            ?>
			.divide-line .icon {
				background-color: #<?php 
            echo $background_color;
            ?>
;
			}


		<?php 
        }
        ?>

				<?php 
        echo ot_get_option('user_custom_css', '');
        ?>

			</style>
			<!--/Customizer CSS-->

		<!-- Fav icon -->
		<?php 
        if (!empty($theme_mods['favicon'])) {
            ?>
			<link rel="shortcut icon" href="<?php 
            echo $theme_mods['favicon'];
            ?>
">
		<?php 
        } else {
            ?>
			<link rel="shortcut icon" href="<?php 
            echo get_template_directory_uri();
            ?>
/assets/images/favicon.png">
		<?php 
        }
    }
Exemplo n.º 2
0
 function darken_css_color($color = '', $percent = 20)
 {
     // return if not specified
     if (empty($color)) {
         return;
     }
     $percent = 100 - $percent;
     $parts = rgb_from_hexdec($color);
     $out = "";
     // Prepare to fill with the results
     for ($i = 0; $i < 3; $i++) {
         $parts[$i] = round($parts[$i] * ((int) $percent / 100));
         // 80/100 = 80%, i.e. 20% darker
         // Now, we'll turn them back into hexadecimal and add them to our output string
         $out .= str_pad(dechex($parts[$i]), 2, '0', STR_PAD_LEFT);
     }
     return "#" . $out;
 }