Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Kalponik oronno
- *
- *
- */
- if ( ! function_exists( 'seo_google_fonts' ) ) :
- /**
- * Register Google fonts.
- *
- * @return string Google fonts URL for the theme.
- */
- function seo_google_fonts() {
- $fonts_url = '';
- $fonts = array();
- $body_font_varient = cs_get_option('body_font_varient');
- $body_font_varient_process = implode(',', $body_font_varient);
- $body_subsets = ':'.$body_font_varient_process.'';
- $heading_font_varient = cs_get_option('heading_font_varient');
- $heading_font_varient_process = implode(',', $heading_font_varient);
- $heading_subsets = ':'.$heading_font_varient_process.'';
- $body_font = cs_get_option('body_font')['family'];
- $body_font .= $body_subsets;
- $heading_font = cs_get_option('heading_font')['family'];
- $heading_font .= $heading_subsets;
- /* translators: If there are characters in your language that are not supported by this font, translate this to 'off'. Do not translate into your own language. */
- if ( 'off' !== esc_html_x( 'on', 'Karla font: on or off', 'textdomain' ) ) {
- $fonts[] = $body_font;
- }
- /* translators: If there are characters in your language that are not supported by this font, translate this to 'off'. Do not translate into your own language. */
- if ( 'off' !== esc_html_x( 'on', 'Lato font: on or off', 'textdomain' ) ) {
- $fonts[] = $heading_font;
- }
- if ( $fonts ) {
- $fonts_url = add_query_arg( array(
- 'family' => urlencode( implode( '|', $fonts ) ),
- ), 'https://fonts.googleapis.com/css' );
- }
- return $fonts_url;
- }
- endif;
- /**
- * Enqueue scripts and styles.
- */
- function seo_google_fonts_prefix() {
- // Add custom fonts, used in the main stylesheet.
- wp_enqueue_style( 'seo_google-fonts', seo_google_fonts(), array(), null );
- }
- add_action( 'wp_enqueue_scripts', 'seo_google_fonts_prefix' );
- // add inline stylesheet
- function seo_custom_css() {
- wp_enqueue_style(
- 'seo_custom_style',
- get_template_directory_uri() . '/assets/css/custom_style.css'
- );
- $body_font = cs_get_option('body_font')['family'];
- $body_font_varient = cs_get_option('body_font')['variant'];
- $heading_font = cs_get_option('heading_font')['family'];
- $heading_font_varient = cs_get_option('heading_font')['family'];
- $enable_boxed_layout = cs_get_option('enable_boxed_layout');
- $body_bg_color = cs_get_option('body_bg_color');
- $body_bg = cs_get_option('body_bg');
- $body_bg_image_array = wp_get_attachment_image_src($body_bg, 'large', false);
- $body_bg_repeat = cs_get_option('body_bg_repeat');
- $body_bg_attachment = cs_get_option('body_bg_attachment');
- $custom_css = '
- body {font-family:'.$body_font.'; font-weight:'.$body_font_varient.'}
- h1,h2,h3,h4,h5,h6{font-family: '.$heading_font.';font-weight:'.$heading_font_varient.'}
- ';
- if($enable_boxed_layout == true){
- if(!empty($body_bg_color)){
- $custom_css .='
- body{background-color:'.$body_bg_color.'}
- ';
- }
- if(!empty($body_bg)){
- $custom_css .='
- body{background-image:url:('.$body_bg_image_array[0].')}
- ';
- }
- if(!empty($body_bg_repeat)){
- $custom_css .='
- body{background-repeat:'.$body_bg_repeat.'}
- ';
- }
- if(!empty($body_bg_attachment)){
- $custom_css .='
- body{background-attachment:'.$body_bg_attachment.'}
- ';
- }
- }
- wp_add_inline_style( 'seo_custom_style', $custom_css );
- }
- add_action( 'wp_enqueue_scripts', 'seo_custom_css' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement