Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $invxtassy_body_font_get = cs_get_option('body_font');
- $invxtassy_heading_font_get = cs_get_option('heading_font');
- function invxtassy_body_gf_url() {
- $font_url = '';
- $invxtassy_body_font_get = cs_get_option('body_font');
- /*
- Translators: If there are characters in your language that are not supported
- by chosen font(s), translate this to 'off'. Do not translate into your own language.
- */
- if ( 'off' !== _x( 'on', 'Google font: on or off', 'invxtassy' ) ) {
- $font_url = add_query_arg( 'family', urlencode( ''.$invxtassy_body_font_get['family'].':300,300i,400,400i,500,500i,600,600i,700,700i,900,900i&subset=latin,latin-ext' ), "//fonts.googleapis.com/css" );
- }
- return $font_url;
- }
- if($invxtassy_heading_font_get['family'] == $invxtassy_body_font_get['family']) {} else {
- function invxtassy_heading_gf_url() {
- $font_url = '';
- $invxtassy_heading_font_get = cs_get_option('heading_font');
- /*
- Translators: If there are characters in your language that are not supported
- by chosen font(s), translate this to 'off'. Do not translate into your own language.
- */
- if ( 'off' !== _x( 'on', 'Google font: on or off', 'invxtassy' ) ) {
- $font_url = add_query_arg( 'family', urlencode( ''.$invxtassy_heading_font_get['family'].':300,300i,400,400i,500,500i,600,600i,700,700i,900,900i&subset=latin,latin-ext' ), "//fonts.googleapis.com/css" );
- }
- return $font_url;
- }
- }
- function invxtassy_options_gf() {
- wp_enqueue_style( 'invxtassy-custom-google-fonts', invxtassy_body_gf_url(), array(), '1.0.0' );
- $invxtassy_body_font_get = cs_get_option('body_font');
- $invxtassy_heading_font_get = cs_get_option('heading_font');
- if($invxtassy_heading_font_get['family'] == $invxtassy_body_font_get['family']) {} else {
- wp_enqueue_style( 'invxtassy-google-heading-fonts', invxtassy_heading_gf_url(), array(), '1.0.0' );
- }
- }
- add_action( 'wp_enqueue_scripts', 'invxtassy_options_gf' );
- I used Codestar framework to select font family & weight.
- $body_font = cs_get_option('body_font');
- $heading_font = cs_get_option('heading_font');
- if (!empty($body_font)) {
- $custom_css .= "
- body{
- font-family: {$body_font['family']};
- font-weight: {$body_font['variant']};
- }
- ";
- }
- if (!empty($heading_font)) {
- $custom_css .= "
- h1, h2, h3, h4, h5, h6{
- font-family: {$heading_font['family']};
- font-weight: {$heading_font['variant']};
- }
- ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement