function x_enqueue_site_styles() { // // Stack data. // $stack = x_get_stack(); $design = x_get_option('x_integrity_design', 'light'); if ($stack == 'integrity' && $design == 'light') { $ext = '-light'; } elseif ($stack == 'integrity' && $design == 'dark') { $ext = '-dark'; } else { $ext = ''; } // // Font data. // $body_font_family_query = x_get_font_family_query(x_get_option('x_body_font_family', 'Lato')); $body_font_weight_and_style = x_get_option('x_body_font_weight', '400'); $body_font_weight = x_get_font_weight($body_font_weight_and_style); $headings_font_family_query = x_get_font_family_query(x_get_option('x_headings_font_family', 'Lato')); $headings_font_weight_and_style = x_get_option('x_headings_font_weight', '400'); $headings_font_weight = x_get_font_weight($headings_font_weight_and_style); $logo_font_family_query = x_get_font_family_query(x_get_option('x_logo_font_family', 'Lato')); $logo_font_weight_and_style = x_get_option('x_logo_font_weight', '400'); $logo_font_weight = x_get_font_weight($logo_font_weight_and_style); $navbar_font_family_query = x_get_font_family_query(x_get_option('x_navbar_font_family', 'Lato')); $navbar_font_weight_and_style = x_get_option('x_navbar_font_weight', '400'); $navbar_font_weight = x_get_font_weight($navbar_font_weight_and_style); $subsets = 'latin,latin-ext'; if (x_get_option('x_custom_font_subsets', '') == '1') { if (x_get_option('x_custom_font_subset_cyrillic', '') == '1') { $subsets .= ',cyrillic,cyrillic-ext'; } if (x_get_option('x_custom_font_subset_greek', '') == '1') { $subsets .= ',greek,greek-ext'; } if (x_get_option('x_custom_font_subset_vietnamese', '') == '1') { $subsets .= ',vietnamese'; } } $custom_font_args = array('family' => $body_font_family_query . ':' . $body_font_weight . ',' . $body_font_weight . 'italic,700,700italic|' . $navbar_font_family_query . ':' . $navbar_font_weight_and_style . '|' . $headings_font_family_query . ':' . $headings_font_weight_and_style . '|' . $logo_font_family_query . ':' . $logo_font_weight_and_style, 'subset' => $subsets); $standard_font_args = array('family' => 'Lato:' . $body_font_weight . ',' . $body_font_weight . 'italic,' . $navbar_font_weight_and_style . ',' . $headings_font_weight_and_style . ',' . $logo_font_weight_and_style . ',700,700italic', 'subset' => $subsets); $get_custom_font_family = add_query_arg($custom_font_args, '//fonts.googleapis.com/css'); $get_standard_font_family = add_query_arg($standard_font_args, '//fonts.googleapis.com/css'); // // Register styles. // wp_register_style('x-stack', X_TEMPLATE_URL . '/framework/css/site/stacks/' . $stack . $ext . '.css', NULL, X_VERSION, 'all'); // // Enqueue styles. // if (is_child_theme()) { $dep = apply_filters('x_enqueue_parent_stylesheet', false) ? array('x-stack') : NULL; wp_enqueue_style('x-child', get_stylesheet_directory_uri() . '/style.css', $dep, X_VERSION, 'all'); } else { wp_enqueue_style('x-stack'); } if (is_rtl()) { wp_enqueue_style('x-rtl', X_TEMPLATE_URL . '/framework/css/site/rtl/' . $stack . '.css', NULL, X_VERSION, 'all'); } if (X_BBPRESS_IS_ACTIVE) { if (x_is_bbpress()) { wp_deregister_style('buttons'); } wp_deregister_style('bbp-default'); wp_enqueue_style('x-bbpress', X_TEMPLATE_URL . '/framework/css/site/bbpress/' . $stack . $ext . '.css', NULL, X_VERSION, 'all'); } if (X_BUDDYPRESS_IS_ACTIVE) { wp_deregister_style('bp-legacy-css'); wp_deregister_style('bp-admin-bar'); wp_enqueue_style('x-buddypress', X_TEMPLATE_URL . '/framework/css/site/buddypress/' . $stack . $ext . '.css', NULL, X_VERSION, 'all'); } if (X_WOOCOMMERCE_IS_ACTIVE) { wp_deregister_style('woocommerce-layout'); wp_deregister_style('woocommerce-general'); wp_deregister_style('woocommerce-smallscreen'); wp_enqueue_style('x-woocommerce', X_TEMPLATE_URL . '/framework/css/site/woocommerce/' . $stack . $ext . '.css', NULL, X_VERSION, 'all'); } if (X_GRAVITY_FORMS_IS_ACTIVE) { wp_enqueue_style('x-gravity-forms', X_TEMPLATE_URL . '/framework/css/site/gravity_forms/' . $stack . $ext . '.css', NULL, X_VERSION, 'all'); } if (X_CONTACT_FORM_7_IS_ACTIVE) { wp_deregister_style('contact-form-7'); } if (x_get_option('x_custom_fonts', '') == '1') { wp_enqueue_style('x-font-custom', $get_custom_font_family, NULL, X_VERSION, 'all'); } else { wp_enqueue_style('x-font-standard', $get_standard_font_family, NULL, X_VERSION, 'all'); } }
function x_get_google_fonts_request() { // // Raw data. // $body_family = x_get_google_fonts_family_query(x_get_option('x_body_font_family')); $body_weight_style = x_get_option('x_body_font_weight'); $body_weight = x_get_font_weight($body_weight_style); $body_key = sanitize_key($body_family); $headings_family = x_get_google_fonts_family_query(x_get_option('x_headings_font_family')); $headings_weight_style = x_get_option('x_headings_font_weight'); $headings_weight = x_get_font_weight($headings_weight_style); $headings_key = sanitize_key($headings_family); $logo_family = x_get_google_fonts_family_query(x_get_option('x_logo_font_family')); $logo_weight_style = x_get_option('x_logo_font_weight'); $logo_weight = x_get_font_weight($logo_weight_style); $logo_key = sanitize_key($logo_family); $navbar_family = x_get_google_fonts_family_query(x_get_option('x_navbar_font_family')); $navbar_weight_style = x_get_option('x_navbar_font_weight'); $navbar_weight = x_get_font_weight($navbar_weight_style); $navbar_key = sanitize_key($navbar_family); // // Refined data. // $fonts = array(); $fonts[$body_key] = array('name' => $body_family, 'weights' => array(), 'source' => x_get_font_data($body_family, 'source')); $fonts[$headings_key] = array('name' => $headings_family, 'weights' => array(), 'source' => x_get_font_data($headings_family, 'source')); $fonts[$logo_key] = array('name' => $logo_family, 'weights' => array(), 'source' => x_get_font_data($logo_family, 'source')); $fonts[$navbar_key] = array('name' => $navbar_family, 'weights' => array(), 'source' => x_get_font_data($navbar_family, 'source')); array_push($fonts[$body_key]['weights'], $body_weight, $body_weight . 'italic', '700', '700italic'); array_push($fonts[$headings_key]['weights'], $headings_weight_style); array_push($fonts[$logo_key]['weights'], $logo_weight_style); array_push($fonts[$navbar_key]['weights'], $navbar_weight_style); $fonts[$body_key]['weights'] = array_unique($fonts[$body_key]['weights']); $fonts[$headings_key]['weights'] = array_unique($fonts[$headings_key]['weights']); $fonts[$logo_key]['weights'] = array_unique($fonts[$logo_key]['weights']); $fonts[$navbar_key]['weights'] = array_unique($fonts[$navbar_key]['weights']); // // Families. // $families = ''; foreach ($fonts as $slug => $data) { if ($data['source'] != 'google') { continue; } $families .= $data['name'] . ':'; foreach ($data['weights'] as $weight) { $families .= $weight . ','; } $families = rtrim($families, ',') . '|'; } $families = rtrim($families, '|'); // // Subsets. // $subsets = 'latin,latin-ext'; if (x_get_option('x_google_fonts_subsets') == '1') { if (x_get_option('x_google_fonts_subset_cyrillic') == '1') { $subsets .= ',cyrillic,cyrillic-ext'; } if (x_get_option('x_google_fonts_subset_greek') == '1') { $subsets .= ',greek,greek-ext'; } if (x_get_option('x_google_fonts_subset_vietnamese') == '1') { $subsets .= ',vietnamese'; } } // // Request (returns and empty string if Google Fonts are not used). // $args = array('family' => $families, 'subset' => $subsets); $request = x_is_google_fonts_used() ? add_query_arg($args, '//fonts.googleapis.com/css') : ''; return $request; }
$x_navbar_link_color_hover = x_get_option('x_navbar_link_color_hover'); $x_navbar_letter_spacing = x_get_option('x_navbar_letter_spacing'); // // 1. Check if fonts are italic. // 2. Remove 'italic' from setting output if it exists to provide us with just // the weight to work with. // 3. Get the font stack. // $x_body_font_is_italic = x_is_font_italic($x_body_font_weight_and_style); $x_headings_font_is_italic = x_is_font_italic($x_headings_font_weight_and_style); $x_logo_font_is_italic = x_is_font_italic($x_logo_font_weight_and_style); $x_navbar_font_is_italic = x_is_font_italic($x_navbar_font_weight_and_style); $x_body_font_weight = x_get_font_weight($x_body_font_weight_and_style); $x_headings_font_weight = x_get_font_weight($x_headings_font_weight_and_style); $x_logo_font_weight = x_get_font_weight($x_logo_font_weight_and_style); $x_navbar_font_weight = x_get_font_weight($x_navbar_font_weight_and_style); $x_body_font_stack = x_get_font_data($x_body_font_family, 'stack'); $x_headings_font_stack = x_get_font_data($x_headings_font_family, 'stack'); $x_logo_font_stack = x_get_font_data($x_logo_font_family, 'stack'); $x_navbar_font_stack = x_get_font_data($x_navbar_font_family, 'stack'); // Header // ============================================================================= $x_navbar_positioning = x_get_navbar_positioning(); $x_logo_adjust_navbar_top = x_get_option('x_logo_adjust_navbar_top'); $x_logo_adjust_navbar_side = x_get_option('x_logo_adjust_navbar_side'); $x_logo_navigation_layout = x_get_option('x_logo_navigation_layout'); $x_logobar_adjust_spacing_top = x_get_option('x_logobar_adjust_spacing_top'); $x_logobar_adjust_spacing_bottom = x_get_option('x_logobar_adjust_spacing_bottom'); $x_navbar_width = x_get_option('x_navbar_width'); $x_navbar_height = x_get_option('x_navbar_height'); $x_navbar_adjust_links_top = x_get_option('x_navbar_adjust_links_top');
$x_body_font_color = x_get_option('x_body_font_color', '#999999'); $x_content_font_size = x_get_option('x_content_font_size', '14'); $x_site_link_color = x_get_option('x_site_link_color', '#ff2a13'); $x_site_link_color_hover = x_get_option('x_site_link_color_hover', '#d80f0f'); // // Check if fonts are italic as well as removing 'italic' from setting output // if it exsists to provide us with just the weight to work with. // $x_body_font_is_italic = x_is_font_italic($x_body_font_weight_and_style); $x_logo_font_is_italic = x_is_font_italic($x_logo_font_weight_and_style); $x_navbar_font_is_italic = x_is_font_italic($x_navbar_font_weight_and_style); $x_headings_font_is_italic = x_is_font_italic($x_headings_font_weight_and_style); $x_body_font_weight = x_get_font_weight($x_body_font_weight_and_style); $x_logo_font_weight = x_get_font_weight($x_logo_font_weight_and_style); $x_navbar_font_weight = x_get_font_weight($x_navbar_font_weight_and_style); $x_headings_font_weight = x_get_font_weight($x_headings_font_weight_and_style); // Header // ============================================================================= $x_navbar_positioning = x_get_navbar_positioning(); $x_logo_adjust_navbar_top = x_get_option('x_logo_adjust_navbar_top', '13'); $x_logo_adjust_navbar_side = x_get_option('x_logo_adjust_navbar_side', '30'); $x_logo_navigation_layout = x_get_option('x_logo_navigation_layout', 'inline'); $x_logobar_adjust_spacing_top = x_get_option('x_logobar_adjust_spacing_top', '15'); $x_logobar_adjust_spacing_bottom = x_get_option('x_logobar_adjust_spacing_bottom', '15'); $x_navbar_width = x_get_option('x_navbar_width', '235'); $x_navbar_height = x_get_option('x_navbar_height', '90'); $x_navbar_adjust_links_top = x_get_option('x_navbar_adjust_links_top', '34'); $x_navbar_adjust_links_top_spacing = x_get_option('x_navbar_adjust_links_top_spacing', 20); $x_navbar_adjust_links_side = x_get_option('x_navbar_adjust_links_side', '50'); $x_navbar_adjust_button = x_get_option('x_navbar_adjust_button', '20'); $x_navbar_adjust_button_size = x_get_option('x_navbar_adjust_button_size', '24');