term_id ); $category_color = BZ\blogzee_get_customizer_option( 'category_' . $term_id . '_color' ); $initial_selector = "body .post-categories .cat-item.cat-" . $term_id . " a, .widget_blogzee_category_collection_widget .categories-wrap .category-item.cat-" . $term_id . " .category-name {"; $hover_selector = "body .post-categories .cat-item.cat-" . $term_id . " a:hover, .widget_blogzee_category_collection_widget .categories-wrap .category-item.cat-" . $term_id . " .category-name:hover {"; $archive_selector = "body.archive.category.category-" . $term_id; if( isset( $category_color['initial'] ) ): if( isset( $category_color['initial']['type'] ) ) : $type = $category_color['initial']['type']; if( isset( $category_color['initial'][$type] ) ) { $initial_selector .= " color : " . blogzee_get_color_format( $category_color['initial'][$type] ) . ";\n"; if( $is_category_archive ) echo $archive_selector, " { color : ", blogzee_get_color_format( $category_color['initial'][$type] ), "} \n"; } endif; endif; if(isset($category_color['hover'] )): if( isset( $category_color['hover']['type'] ) ) : $type = $category_color['hover']['type']; if( isset( $category_color['hover'][$type] ) ) { $hover_selector .= "color : " . blogzee_get_color_format( $category_color['hover'][$type] ) . ";\n"; if( $is_category_archive ) echo $archive_selector, ":hover { color : ", blogzee_get_color_format( $category_color['hover'][$type] ), "} \n"; } endif; endif; $category_color_bk = BZ\blogzee_get_customizer_option( 'category_background_' .$term_id. '_color' ); if(isset($category_color_bk['initial'] )): if( isset( $category_color_bk['initial']['type'] ) ) : $type = $category_color_bk['initial']['type']; if( isset( $category_color_bk['initial'][$type] ) ) { $initial_selector .= "background : " . blogzee_get_color_format( $category_color_bk['initial'][$type] ) . ";\n"; if( $is_category_archive ) echo $archive_selector, " .archive-title i { color : ", blogzee_get_color_format( $category_color_bk['initial'][$type] ), "}\n"; } endif; endif; if(isset($category_color_bk['hover'] )) : if( isset( $category_color_bk['hover']['type'] ) ) : $type = $category_color_bk['hover']['type']; if( isset( $category_color_bk['hover'][$type] ) ) $hover_selector .= "background : " . blogzee_get_color_format( $category_color_bk['hover'][$type] ) . ";\n"; endif; endif; $initial_selector .= "}\n"; $hover_selector .= "}\n"; echo $initial_selector, $hover_selector; endforeach; endif; } endif; // tags colors if( ! function_exists( 'blogzee_tags_bk_colors_styles' ) ) : /** * Generates css code for font size * * @package Blogzee Pro * @since 1.0.0 */ function blogzee_tags_bk_colors_styles() { $totalTags = get_tags(); if( $totalTags ) : foreach( $totalTags as $singleTag ) : $term_id = absint( $singleTag->term_id ); $tag_color = BZ\blogzee_get_customizer_option( 'tag_' . $term_id . '_color' ); $selector = "body .tags-wrap .tags-item.tag-" . $term_id; if(isset($tag_color['initial'] )): if( isset( $tag_color['initial']['type'] ) ) : $type = $tag_color['initial']['type']; if( isset( $tag_color['initial'][$type] ) ) echo $selector, " span { color : ", blogzee_get_color_format( $tag_color['initial'][$type] ), "} \n"; endif; endif; if(isset($tag_color['hover'] )): if( isset( $tag_color['hover']['type'] ) ) : $type = $tag_color['hover']['type']; if( isset( $tag_color['hover'][$type] ) ) echo $selector, ":hover span { color : ", blogzee_get_color_format( $tag_color['hover'][$type] ), "} \n"; endif; endif; $tag_color_bk = BZ\blogzee_get_customizer_option( 'tag_background_' . $term_id . '_color' ); if(isset($tag_color_bk['initial'] )) : if( isset( $tag_color_bk['initial']['type'] ) ) : $type = $tag_color_bk['initial']['type']; if( isset( $tag_color_bk['initial'][$type] ) ) echo $selector, "{ background : ", blogzee_get_color_format( $tag_color_bk['initial'][$type] ), "} \n"; endif; endif; if(isset($tag_color_bk['hover'] )) : if( isset( $tag_color_bk['hover']['type'] ) ) : $type = $tag_color_bk['hover']['type']; if( isset( $tag_color_bk['hover'][$type] ) ) echo $selector, ":hover { background : ", blogzee_get_color_format( $tag_color_bk['hover'][$type] ), "} \n"; endif; endif; endforeach; endif; } endif; // Image ratio change if( ! function_exists( 'blogzee_image_ratio' ) ) : /** * Generate css code image ration controls * * @package Blogzee Pro * @since 1.0.0 */ function blogzee_image_ratio( $selector, $control, $is_variable = false ) { $decoded_control = BZ\blogzee_get_customizer_option( $control ); $value = '100%'; if( ! $decoded_control ) return; if( $is_variable ) echo "body.blogzee-variables {\n"; if( isset( $decoded_control['desktop'] ) && $decoded_control['desktop'] > 0 ) : if( $is_variable ) { echo $selector, " : ", esc_html( $decoded_control['desktop'] ), ";\n"; } else { echo $selector, "{ padding-bottom : calc(", esc_html( $decoded_control['desktop'] ), " * ", esc_html( $value ), "); }"; } endif; if( isset( $decoded_control['tablet'] ) && $decoded_control['tablet'] > 0 ) : if( $is_variable ) { echo $selector, "-tab : ", esc_html( $decoded_control['tablet'] ), ";\n"; } else { echo "@media(max-width: 940px) { ", $selector, "{ padding-bottom : calc(", esc_html( $decoded_control['tablet'] ), "* ", esc_html( $value ), "); } }\n"; } endif; if( isset( $decoded_control['smartphone'] ) && $decoded_control['smartphone'] > 0 ) : if( $is_variable ) { echo $selector, "-mobile : ", esc_html( $decoded_control['smartphone'] ), ";\n"; } else { echo "@media(max-width: 610px) { ", $selector, "{ padding-bottom : calc(", esc_html( $decoded_control['smartphone'] ), " * ", esc_html( $value ), "); } }\n"; } endif; if( $is_variable ) echo '}'; } endif; // Background Color (Initial Variable) if( ! function_exists( 'blogzee_initial_bk_color_variable' ) ) : /** * Generate css code for top header color options * * @package Blogzee Pro * @since 1.0.0 */ function blogzee_initial_bk_color_variable( $selector, $control ) { $decoded_control = BZ\blogzee_get_customizer_option( $control ); if( ! $decoded_control ) return; if( array_key_exists( 'type', $decoded_control ) && isset( $decoded_control[ $decoded_control['type'] ] ) ) echo "body { ", $selector, " : ", blogzee_get_color_format( $decoded_control[ $decoded_control['type'] ] ), "}\n"; } endif; // Site Background Color if( ! function_exists( 'blogzee_background_control' ) ) : /** * Generate css code for background control. * * @package Blogzee Pro * @since 1.0.0 */ function blogzee_background_control( $selector, $control, $property = 'background' ) { $decoded_control = BZ\blogzee_get_customizer_option( $control ); if( ! $decoded_control ) return; if( isset( $decoded_control['type'] ) ) : $type = $decoded_control['type']; switch( $type ) { case 'image' : echo $selector, " { \n"; if( isset( $decoded_control[$type]['url'] ) ) echo "background-image: url(", esc_url( $decoded_control[$type]['url'] ), ");\n"; if( isset( $decoded_control['repeat'] ) ) echo "background-repeat: ", esc_html( $decoded_control['repeat'] ), ";\n"; if( isset( $decoded_control['position'] ) ) echo "background-position:", esc_html( $decoded_control['position'] ), ";\n"; if( isset( $decoded_control['attachment'] ) ) echo "background-attachment: ", esc_html( $decoded_control['attachment'] ), ";\n"; if( isset( $decoded_control['size'] ) ) echo "background-size: ", esc_html( $decoded_control['size'] ), ";\n"; echo '}'; break; default: if( isset( $decoded_control[$type] ) ) echo $selector . "{ ". $property .": " .blogzee_get_color_format( $decoded_control[$type] ). "}"; } endif; } endif; // spacing control if( ! function_exists( 'blogzee_spacing_control' ) ) : /** * Generate css code for variable change with responsive for spacing controls * * @package Blogzee Pro * @since 1.0.0 */ function blogzee_spacing_control( $selector, $control, $property ) { $decoded_control = BZ\blogzee_get_customizer_option( $control ); if( ! $decoded_control ) return; if( isset( $decoded_control['desktop'] ) ) : $desktop = $decoded_control['desktop']; echo $selector, '{ ', esc_html( $property ), ' : ', esc_html( $desktop['top'] ), 'px ', esc_html( $desktop['right'] ), 'px ', esc_html( $desktop['bottom'] ),'px ', esc_html( $desktop['left'] ),'px; }'; endif; if( isset( $decoded_control['tablet'] ) ) : $tablet = $decoded_control['tablet']; echo '@media(max-width: 940px) {', $selector, '{ ', esc_html( $property ), ' : ', esc_html( $tablet['top'] ), 'px ', esc_html( $tablet['right'] ), 'px ', esc_html( $tablet['bottom'] ), 'px ', esc_html( $tablet['left'] ), 'px ;} }'; endif; if( isset( $decoded_control['smartphone'] ) ) : $smartphone = $decoded_control['smartphone']; echo '@media(max-width: 610px) { ', $selector, '{ ', esc_html( $property ), ' : ', esc_html( $smartphone['top'] ), 'px ', esc_html( $smartphone['right'] ), 'px ', esc_html( $smartphone['bottom'] ), 'px ', esc_html( $smartphone['left'] ), 'px; } }'; endif; } endif; if( ! function_exists( 'blogzee_preset_color_control' ) ) : /** * Generate css variable * * @since 1.0.0 */ function blogzee_preset_color_control( $control, $variable ) { $decoded_control = BZ\blogzee_get_customizer_option( $control ); if( empty( $decoded_control ) || ! is_array( $decoded_control ) ) return; if( array_key_exists( 'color_palettes', $decoded_control ) && array_key_exists( 'active_palette', $decoded_control ) ) : extract( $decoded_control ); $colors = $color_palettes[ $active_palette ]; if( ! empty( $colors ) && is_array( $colors ) ) : echo "body {\n"; foreach( $colors as $index => $color ) : $count = $index + 1; echo $variable, $count, ": ", esc_html( $color ), ";\n"; endforeach; echo "}\n"; endif; endif; } endif; if( ! function_exists( 'blogzee_typography_preset' ) ) : /** * Generate css variable * * @since 1.0.0 */ function blogzee_typography_preset() { $decoded_control = BZ\blogzee_get_customizer_option( 'typography_presets' ); if( count( $decoded_control ) > 0 ) : $typographies = $decoded_control['typographies']; $labels = $decoded_control['labels']; if( count( $typographies ) > 0 ) : foreach( $typographies as $index => $typography ) : $variable = '--blogzee-global-preset-typography-'; $count = $index + 1; $variable .= $count . '-font'; blogzee_typography_control( $variable, $typography, true ); endforeach; endif; endif; } endif;