Current File : /home/kelaby89/teamhachem.com/wp-content/themes/artkombat/inc/theme-style/theme-style.php |
<?php if ( ! defined( 'ABSPATH' ) ) { die( 'Direct access forbidden.' ); }
/**
* Generating inline css styles for customization
*/
if ( !function_exists('artkombat_generate_css') ) {
function artkombat_generate_css() {
global $wp_query;
// List of attributes
$css = array(
'main_color' => true,
'second_color' => true,
'second_lighter_color' => true,
'gray_color' => true,
'white_color' => true,
'black_color' => true,
'footer_color' => true,
'nav_bg' => true,
'nav_opacity_top' => true,
'nav_opacity_scroll' => true,
'border_radius' => true,
);
// Escaping all the attributes
$css_rgb = array();
foreach ($css as $key => $item) {
$css[$key] = esc_attr(fw_get_db_customizer_option($key));
$css_rgb[$key] = sscanf(esc_attr(fw_get_db_customizer_option($key)), "#%02x%02x%02x");
}
// Setting different color scheme for page
if ( function_exists( 'FW' ) ) {
$artkombat_color_schemes = array();
$artkombat_color_schemes_ = fw_get_db_settings_option( 'items' );
if ( !empty($artkombat_color_schemes_) ) {
foreach ($artkombat_color_schemes_ as $v) {
$artkombat_color_schemes[$v['slug']] = $v;
}
}
}
$artkombat_current_scheme = apply_filters('artkombat_current_scheme', array());
if ($artkombat_current_scheme == 'default' OR empty($artkombat_current_scheme)) $artkombat_current_scheme = 1;
if ( function_exists( 'FW' ) AND !empty($artkombat_current_scheme) ) {
foreach (array(
'main_color' => 'main-color',
'second_color' => 'second-color',
'gray_color' => 'gray-color',
'black_color' => 'black-color') as $k => $v) {
if ( !empty($artkombat_color_schemes[$artkombat_current_scheme][$v]) ) {
$css[$k] = esc_attr($artkombat_color_schemes[$artkombat_current_scheme][$v]);
$css_rgb[$k] = sscanf(esc_attr($artkombat_color_schemes[$artkombat_current_scheme][$v]), "#%02x%02x%02x");
}
}
}
$css['main_lighter_color'] = artkombat_adjustBrightness($css['main_color'], 30);
include get_template_directory() . '/inc/theme-style/google-fonts.php';
$theme_style = "";
$theme_style .= "
:root {
--black: {$css['black_color']} !important;
--gray: {$css['gray_color']} !important;
--white: {$css['white_color']} !important;
--main: {$css['main_color']} !important;
--main-lighter: {$css['main_lighter_color']} !important;
--second: {$css['second_color']} !important;
--font-main: '{$css['font_main']}' !important;
--font-headers: '{$css['font_headers']}' !important;
}
";
/**
* Theme Specific inline styles
*/
if ( function_exists( 'FW' ) ) {
$heading_bg = fw_get_db_settings_option( 'heading_bg' );
if (! empty( $heading_bg ) ) {
$theme_style .= '.heading.bg-image { background-image: url(' . esc_url( $heading_bg['url'] ) . ') !important; } ';
}
$header_bg = fw_get_db_settings_option( 'header_bg' );
$featured_bg = fw_get_db_settings_option( 'featured_bg' );
if (! empty( $header_bg ) OR $featured_bg == 'enabled' ) {
if ( !is_single() && has_post_thumbnail() && $featured_bg == 'enabled') {
$theme_style .= '.page-header { background-image: url(' . esc_url( get_the_post_thumbnail_url( $wp_query->get_queried_object_id(), 'full') ) . ') !important; } ';
}
else
if ( !empty( $header_bg['url'] ) ) {
$theme_style .= '.page-header { background-image: url(' . esc_url( $header_bg['url'] ) . ') !important; } ';
}
}
$header_overlay = fw_get_db_settings_option( 'header_overlay' );
$header_overlay_position = fw_get_db_settings_option( 'header_overlay_position' );
if (! empty( $header_overlay ) ) {
$theme_style .= '.page-header::after { background-image: url(' . esc_url( $header_overlay['url'] ) . ') !important; } ';
}
$theme_icon = fw_get_db_settings_option( 'theme-icon-main' );
if (! empty( $theme_icon ) ) {
$theme_style .= '.theme-icon-main { background-image: url(' . esc_url( $theme_icon['url'] ) . ') !important; } ';
}
$theme_icon_second = fw_get_db_settings_option( 'theme-icon-second' );
if (! empty( $theme_icon_second ) ) {
$theme_style .= '.woocommerce-MyAccount-navigation .header-widget, .widget-area .header-widget, .theme-icon-second { background-image: url(' . esc_url( $theme_icon_second['url'] ) . ') !important; } ';
}
$footer_bg = fw_get_db_settings_option( 'footer_bg' );
if (! empty( $footer_bg ) ) {
$theme_style .= '#ltx-widgets-footer { background-image: url(' . esc_url( $footer_bg['url'] ) . ') !important; } ';
}
$footer_top_bg = fw_get_db_settings_option( 'footer_top_bg' );
if (! empty( $footer_top_bg ) ) {
$theme_style .= '#ltx-logo-footer { background-image: url(' . esc_url( $footer_top_bg['url'] ) . ') !important; } ';
}
$subscribe_bg = fw_get_db_settings_option( 'subscribe_bg' );
if (! empty( $subscribe_bg ) ) {
$theme_style .= '.subscribe-block { background-image: url(' . esc_url( $subscribe_bg['url'] ) . ') !important; } ';
}
$bg_404 = fw_get_db_settings_option( '404_bg' );
if (! empty( $bg_404 ) ) {
$theme_style .= 'body.error404 { background-image: url(' . esc_url( $bg_404['url'] ) . ') !important; } ';
}
$go_top_img = fw_get_db_settings_option( 'go_top_img' );
if (! empty( $go_top_img ) ) {
$theme_style .= '.go-top:before { background-image: url(' . esc_url( $go_top_img['url'] ) . ') !important; } ';
}
$nav_opacity = fw_get_db_customizer_option('nav_opacity');
if ( isset($nav_opacity) ) {
$theme_style .= '#nav-wrapper.navbar-layout-transparent nav.navbar { background-color: rgba('.esc_attr($css_rgb['black_color'][0]).', '.esc_attr($css_rgb['black_color'][1]).', '.esc_attr($css_rgb['black_color'][2]).', '.esc_attr($nav_opacity).'); } ';
}
$nav_opacity_scroll = fw_get_db_customizer_option('nav_opacity_scroll');
if ( isset($nav_opacity_scroll) ) {
$theme_style .= '#nav-wrapper.navbar-layout-transparent nav.navbar.dark { background-color: rgba('.esc_attr($css_rgb['black_color'][0]).', '.esc_attr($css_rgb['black_color'][1]).', '.esc_attr($css_rgb['black_color'][2]).', '.esc_attr($nav_opacity_scroll).'); } ';
}
$logo_height = fw_get_db_customizer_option('logo_height');
if ( !empty($logo_height) ) {
$theme_style .= 'nav.navbar .logo img { max-height: '.esc_attr($logo_height).'px; } ';
}
}
$theme_style = str_replace( array( "\n", "\r" ), '', $theme_style );
return $theme_style;
}
}