Astra_Ext_Typography_Loader::add_fonts()
Add Font Family Callback
Description
Return
(void)
Source
File: addons/typography/classes/class-astra-ext-typography-loader.php
public function add_fonts() { $font_family_header_content = astra_get_option( 'font-family-header-content' ); $font_weight_header_content = astra_get_option( 'font-weight-header-content' ); Astra_Fonts::add_font( $font_family_header_content, $font_weight_header_content ); $font_family_site_title = astra_get_option( 'font-family-site-title' ); $font_weight_site_title = astra_get_option( 'font-weight-site-title' ); Astra_Fonts::add_font( $font_family_site_title, $font_weight_site_title ); $font_family_site_tagline = astra_get_option( 'font-family-site-tagline' ); $font_weight_site_tagline = astra_get_option( 'font-weight-site-tagline' ); Astra_Fonts::add_font( $font_family_site_tagline, $font_weight_site_tagline ); $font_family_primary_menu = astra_get_option( 'font-family-primary-menu' ); $font_weight_primary_menu = astra_get_option( 'font-weight-primary-menu' ); Astra_Fonts::add_font( $font_family_primary_menu, $font_weight_primary_menu ); $font_family_primary_dropdown_menu = astra_get_option( 'font-family-primary-dropdown-menu' ); $font_weight_primary_dropdown_menu = astra_get_option( 'font-weight-primary-dropdown-menu' ); Astra_Fonts::add_font( $font_family_primary_dropdown_menu, $font_weight_primary_dropdown_menu ); $font_family_single_entry_title = astra_get_option( 'font-family-entry-title' ); $font_weight_single_entry_title = astra_get_option( 'font-weight-entry-title' ); Astra_Fonts::add_font( $font_family_single_entry_title, $font_weight_single_entry_title ); $font_family_archive_summary_title = astra_get_option( 'font-family-archive-summary-title' ); $font_weight_archive_summary_title = astra_get_option( 'font-weight-archive-summary-title' ); Astra_Fonts::add_font( $font_family_archive_summary_title, $font_weight_archive_summary_title ); $font_family_archive_page_title = astra_get_option( 'font-family-page-title' ); $font_weight_archive_page_title = astra_get_option( 'font-weight-page-title' ); Astra_Fonts::add_font( $font_family_archive_page_title, $font_weight_archive_page_title ); $font_family_post_meta = astra_get_option( 'font-family-post-meta' ); $font_weight_post_meta = astra_get_option( 'font-weight-post-meta' ); Astra_Fonts::add_font( $font_family_post_meta, $font_weight_post_meta ); $font_family_widget_title = astra_get_option( 'font-family-widget-title' ); $font_weight_widget_title = astra_get_option( 'font-weight-widget-title' ); Astra_Fonts::add_font( $font_family_widget_title, $font_weight_widget_title ); $font_family_widget_content = astra_get_option( 'font-family-widget-content' ); $font_weight_widget_content = astra_get_option( 'font-weight-widget-content' ); Astra_Fonts::add_font( $font_family_widget_content, $font_weight_widget_content ); $font_family_footer_content = astra_get_option( 'font-family-footer-content' ); $font_weight_footer_content = astra_get_option( 'font-weight-footer-content' ); Astra_Fonts::add_font( $font_family_footer_content, $font_weight_footer_content ); if ( astra_addon_has_gcp_typo_preset_compatibility() ) { $font_family_h1 = astra_get_option( 'font-family-h1' ); $font_weight_h1 = astra_get_option( 'font-weight-h1' ); Astra_Fonts::add_font( $font_family_h1, $font_weight_h1 ); $font_family_h2 = astra_get_option( 'font-family-h2' ); $font_weight_h2 = astra_get_option( 'font-weight-h2' ); Astra_Fonts::add_font( $font_family_h2, $font_weight_h2 ); $font_family_h3 = astra_get_option( 'font-family-h3' ); $font_weight_h3 = astra_get_option( 'font-weight-h3' ); Astra_Fonts::add_font( $font_family_h3, $font_weight_h3 ); $font_family_h4 = astra_get_option( 'font-family-h4' ); $font_weight_h4 = astra_get_option( 'font-weight-h4' ); Astra_Fonts::add_font( $font_family_h4, $font_weight_h4 ); $font_family_h5 = astra_get_option( 'font-family-h5' ); $font_weight_h5 = astra_get_option( 'font-weight-h5' ); Astra_Fonts::add_font( $font_family_h5, $font_weight_h5 ); $font_family_h6 = astra_get_option( 'font-family-h6' ); $font_weight_h6 = astra_get_option( 'font-weight-h6' ); Astra_Fonts::add_font( $font_family_h6, $font_weight_h6 ); } $font_family_button = astra_get_option( 'font-family-button' ); $font_weight_button = astra_get_option( 'font-weight-button' ); Astra_Fonts::add_font( $font_family_button, $font_weight_button ); if ( true === astra_addon_builder_helper()->is_header_footer_builder_active ) { /** * Footer - Copyright */ if ( Astra_Addon_Builder_Helper::is_component_loaded( 'copyright', 'footer' ) ) { $copyright_font_family = astra_get_option( 'font-family-section-footer-copyright' ); $copyright_font_weight = astra_get_option( 'font-weight-section-footer-copyright' ); Astra_Fonts::add_font( $copyright_font_family, $copyright_font_weight ); } /** * Header - Account */ if ( Astra_Addon_Builder_Helper::is_component_loaded( 'account', 'header' ) ) { $account_font_family = astra_get_option( 'section-header-account-menu-font-family' ); $account_font_weight = astra_get_option( 'section-header-account-menu-font-weight' ); Astra_Fonts::add_font( $account_font_family, $account_font_weight ); } /** * Footer - HTML */ $num_of_footer_html = astra_addon_builder_helper()->num_of_footer_html; for ( $index = 1; $index <= $num_of_footer_html; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'html-' . $index, 'footer' ) ) { continue; } $_prefix = 'section-fb-html-' . $index; $html_font_family = astra_get_option( 'font-family-' . $_prefix ); $html_font_weight = astra_get_option( 'font-weight-' . $_prefix ); Astra_Fonts::add_font( $html_font_family, $html_font_weight ); } /** * Header - HTML */ $num_of_header_html = astra_addon_builder_helper()->num_of_header_html; for ( $index = 1; $index <= $num_of_header_html; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'html-' . $index, 'header' ) ) { continue; } $_prefix = 'section-hb-html-' . $index; $html_font_family = astra_get_option( 'font-family-' . $_prefix ); $html_font_weight = astra_get_option( 'font-weight-' . $_prefix ); Astra_Fonts::add_font( $html_font_family, $html_font_weight ); } /** * Footer - Button */ $num_of_footer_button = astra_addon_builder_helper()->num_of_footer_button; for ( $index = 1; $index <= $num_of_footer_button; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'button-' . $index, 'footer' ) ) { continue; } $_prefix = 'button' . $index; $btn_font_family = astra_get_option( 'footer-' . $_prefix . '-font-family' ); $btn_font_weight = astra_get_option( 'footer-' . $_prefix . '-font-weight' ); Astra_Fonts::add_font( $btn_font_family, $btn_font_weight ); } /** * Header - Button */ $num_of_header_button = astra_addon_builder_helper()->num_of_header_button; for ( $index = 1; $index <= $num_of_header_button; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'button-' . $index, 'header' ) ) { continue; } $_prefix = 'button' . $index; $btn_font_family = astra_get_option( 'header-' . $_prefix . '-font-family' ); $btn_font_weight = astra_get_option( 'header-' . $_prefix . '-font-weight' ); Astra_Fonts::add_font( $btn_font_family, $btn_font_weight ); } /** * Footer - Social */ $num_of_footer_social_icons = astra_addon_builder_helper()->num_of_footer_social_icons; for ( $index = 1; $index <= $num_of_footer_social_icons; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'social-icons-' . $index, 'footer' ) ) { continue; } $_prefix = 'section-fb-social-icons-' . $index; $social_footer_font_family = astra_get_option( 'font-family-' . $_prefix ); $social_footer_font_weight = astra_get_option( 'font-weight-' . $_prefix ); Astra_Fonts::add_font( $social_footer_font_family, $social_footer_font_weight ); } /** * Header - Social */ $num_of_header_social_icons = astra_addon_builder_helper()->num_of_header_social_icons; for ( $index = 1; $index <= $num_of_header_social_icons; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'social-icons-' . $index, 'header' ) ) { continue; } $_prefix = 'section-hb-social-icons-' . $index; $social_header_font_family = astra_get_option( 'font-family-' . $_prefix ); $social_header_font_weight = astra_get_option( 'font-weight-' . $_prefix ); Astra_Fonts::add_font( $social_header_font_family, $social_header_font_weight ); } /** * Header - Widgets */ $num_of_header_widgets = astra_addon_builder_helper()->num_of_header_widgets; for ( $index = 1; $index <= $num_of_header_widgets; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'widget-' . $index, 'header' ) ) { continue; } $_prefix = 'widget-' . $index; $widget_font_family = astra_get_option( 'header-' . $_prefix . '-font-family' ); $widget_font_weight = astra_get_option( 'header-' . $_prefix . '-font-weight' ); Astra_Fonts::add_font( $widget_font_family, $widget_font_weight ); $widget_content_font_family = astra_get_option( 'header-' . $_prefix . '-content-font-family' ); $widget_content_font_weight = astra_get_option( 'header-' . $_prefix . '-content-font-weight' ); Astra_Fonts::add_font( $widget_content_font_family, $widget_content_font_weight ); } /** * Footer - Widgets */ $num_of_footer_widgets = astra_addon_builder_helper()->num_of_footer_widgets; for ( $index = 1; $index <= $num_of_footer_widgets; $index++ ) { if ( ! Astra_Addon_Builder_Helper::is_component_loaded( 'widget-' . $index, 'footer' ) ) { continue; } $_prefix = 'widget-' . $index; $widget_font_family = astra_get_option( 'footer-' . $_prefix . '-font-family' ); $widget_font_weight = astra_get_option( 'footer-' . $_prefix . '-font-weight' ); Astra_Fonts::add_font( $widget_font_family, $widget_font_weight ); $widget_content_font_family = astra_get_option( 'footer-' . $_prefix . '-content-font-family' ); $widget_content_font_weight = astra_get_option( 'footer-' . $_prefix . '-content-font-weight' ); Astra_Fonts::add_font( $widget_content_font_family, $widget_content_font_weight ); } /** * Mobile Trigger */ $header_menu_trigger_font_family = astra_get_option( 'mobile-header-label-font-family' ); $header_menu_trigger_font_weight = astra_get_option( 'mobile-header-label-font-weight' ); Astra_Fonts::add_font( $header_menu_trigger_font_family, $header_menu_trigger_font_weight ); /** * Header - Menu */ $component_limit = astra_addon_builder_helper()->component_limit; for ( $index = 1; $index <= $component_limit; $index++ ) { $_prefix = 'menu' . $index; $submenu_font_family = astra_get_option( 'header-font-family-' . $_prefix . '-sub-menu' ); $submenu_font_weight = astra_get_option( 'header-font-weight-' . $_prefix . '-sub-menu' ); Astra_Fonts::add_font( $submenu_font_family, $submenu_font_weight ); if ( 3 > $index ) { $megamenu_font_family = astra_get_option( 'header-' . $_prefix . '-megamenu-heading-font-family' ); $megamenu_font_weight = astra_get_option( 'header-' . $_prefix . '-megamenu-heading-font-weight' ); Astra_Fonts::add_font( $megamenu_font_family, $megamenu_font_weight ); } } /** * Footer Menu */ $footer_menu_font_family = astra_get_option( 'footer-menu-font-family' ); $footer_menu_font_weight = astra_get_option( 'footer-menu-font-weight' ); Astra_Fonts::add_font( $footer_menu_font_family, $footer_menu_font_weight ); /** * Mobile menu */ $submenu_font_family = astra_get_option( 'header-mobile-menu-sub-menu-font-family' ); $submenu_font_weight = astra_get_option( 'header-mobile-menu-sub-menu-font-weight' ); Astra_Fonts::add_font( $submenu_font_family, $submenu_font_weight ); /** * Header - Language Switcher */ $header_lang_switcher_font_family = astra_get_option( 'font-family-section-hb-language-switcher' ); $header_lang_switcher_font_weight = astra_get_option( 'font-weight-section-hb-language-switcher' ); Astra_Fonts::add_font( $header_lang_switcher_font_family, $header_lang_switcher_font_weight ); /** * Footer - Language Switcher */ $footer_lang_switcher_font_family = astra_get_option( 'font-family-section-fb-language-switcher' ); $footer_lang_switcher_font_weight = astra_get_option( 'font-weight-section-fb-language-switcher' ); Astra_Fonts::add_font( $footer_lang_switcher_font_family, $footer_lang_switcher_font_weight ); } }
Expand full source code Collapse full source code View on Trac