Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* custom-style.php */
- <?php
- if ( ! function_exists( 'camelia_fonts_url' ) ) :
- /**
- * Register Google fonts.
- *
- * @return string Google fonts URL for the theme.
- */
- function camelia_fonts_url() {
- $fonts_url = '';
- $fonts = array();
- $body_font_type = cs_get_option('body_font_type');
- if(!empty($body_font_type)){
- $body_font_type_process = implode(",",$body_font_type);
- }else {
- $body_font_type_process = '500';
- }
- $body_subsets = ':'.$body_font_type_process.'';
- $header_font_type = cs_get_option('header_font_type');
- if(!empty($header_font_type)){
- $header_font_type_process = implode(",",$header_font_type);
- }else {
- $header_font_type_process = '700';
- }
- $header_subsets = ':'.$header_font_type_process.'';
- $camelia_body_font = cs_get_option('camelia_body_font') ['family'];
- $camelia_body_font .= $body_subsets;
- $camelia_header_font = cs_get_option('camelia_header_font') ['family'];
- $camelia_header_font .= $header_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', 'camelia-crazycafe' ) ) {
- $fonts[] = $camelia_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', 'camelia-crazycafe' ) ) {
- $fonts[] = $camelia_header_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 camelia_scripts() {
- // Add custom fonts, used in the main stylesheet.
- wp_enqueue_style( 'camelia-google-fonts', camelia_fonts_url(), array(), null );
- }
- add_action( 'wp_enqueue_scripts', 'camelia_scripts' );
- function camelia_custom_css() {
- wp_enqueue_style( 'camelia-custom-style', get_template_directory_uri().'/assets/css/custom-style.css');
- $camelia_body_font = cs_get_option('camelia_body_font') ['family'];
- $camelia_header_font = cs_get_option('camelia_header_font') ['family'];
- $camelia_body_font_width = cs_get_option('camelia_body_font') ['variant'];
- $camelia_header_font_width = cs_get_option('camelia_header_font') ['variant'];
- $enable_box_layout = cs_get_option('enable_box_layout');
- $body_bg_color = cs_get_option('body_bg_color');
- $body_bg = cs_get_option('body_bg');
- $body_bg_img_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');
- //var_dump($body_bg);
- $custom_css = '
- body {font-family: '.$camelia_body_font.'; font-weight: '.$camelia_body_font_width.'}
- h1, h2, h3, h4, h5, h6 {font-family: '.$camelia_header_font.'; font-weight: '.$camelia_header_font_width.'}
- ';
- if($enable_box_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_img_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('camelia-custom-style',$custom_css);
- }
- add_action( 'wp_enqueue_scripts', 'camelia_custom_css' );
- /* CodeStar Option */
- // typography
- $options[] = array(
- 'name' => 'camelia_typography_section',
- 'title' => 'Typography',
- 'icon' => 'fa fa-file-code-o',
- 'fields' => array(
- array(
- 'id' => 'camelia_body_font',
- 'type' => 'typography',
- 'title' => 'Body font',
- 'default' => array(
- 'family' => 'Roboto',
- 'variant' => 'regular',
- 'font' => 'google',
- ),
- ),
- array(
- 'id' => 'body_font_type',
- 'type' => 'checkbox',
- 'title' => 'Body font type',
- 'options' => array(
- '100' => '100',
- '100i' => '100i',
- '300' => '300',
- '300i' => '300i',
- '400' => '400',
- '400i' => '400i',
- '500' => '500',
- '500i' => '500i',
- '700' => '700',
- '700i' => '700i',
- '900' => '900',
- '900i' => '900i',
- ),
- 'default' => array( '400', '400i', '700', '700i',)
- ),
- array(
- 'id' => 'camelia_header_font',
- 'type' => 'typography',
- 'title' => 'Header font',
- 'default' => array(
- 'family' => 'Noto Serif',
- 'variant' => '700',
- 'font' => 'google',
- ),
- ),
- array(
- 'id' => 'header_font_type',
- 'type' => 'checkbox',
- 'title' => 'Header font type',
- 'options' => array(
- '100' => '100',
- '100i' => '100i',
- '300' => '300',
- '300i' => '300i',
- '400' => '400',
- '400i' => '400i',
- '500' => '500',
- '500i' => '500i',
- '700' => '700',
- '700i' => '700i',
- '900' => '900',
- '900i' => '900i',
- ),
- 'default' => array( '400', '400i', '700', '700i',)
- ),
- )
- );
- // style
- $options[] = array(
- 'name' => 'camelia_style_setting',
- 'title' => 'Style Setting',
- 'icon' => 'fa fa-pencil-square-o',
- 'fields' => array(
- array(
- 'id' => 'enable_preloaded',
- 'type' => 'switcher',
- 'title' => 'Enable Preloaded',
- 'default' => true
- ),
- array(
- 'id' => 'enable_box_layout',
- 'type' => 'switcher',
- 'title' => 'Enable box layout',
- 'default' => false
- ),
- array(
- 'id' => 'body_bg_color',
- 'type' => 'color_picker',
- 'title' => 'Body background color',
- 'dependency' => array( 'enable_box_layout', '==', 'true' ),
- ),
- array(
- 'id' => 'body_bg',
- 'type' => 'image',
- 'title' => 'Body background image',
- 'dependency' => array( 'enable_box_layout', '==', 'true' ),
- ),
- array(
- 'id' => 'body_bg_repeat',
- 'type' => 'select',
- 'title' => 'Body Background Repeat',
- 'options' => array(
- 'repeat' => 'Repeat',
- 'no-repeat' => 'No Repeat',
- 'cover' => 'Cover',
- ),
- 'default' => 'repeat',
- 'dependency' => array( 'enable_box_layout', '==', 'true' ),
- ),
- array(
- 'id' => 'body_bg_attachment',
- 'type' => 'select',
- 'title' => 'Body Background Attachment',
- 'options' => array(
- 'fixed' => 'Fixed',
- 'scroll' => 'Scroll',
- ),
- 'default' => 'fixed',
- 'dependency' => array( 'enable_box_layout', '==', 'true' ),
- ),
- )
- );
- /* Header.php for scripts option */
- ?><!DOCTYPE html>
- <html <?php language_attributes(); ?>>
- <head>
- <meta charset="<?php bloginfo( 'charset' ); ?>">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="profile" href="http://gmpg.org/xfn/11">
- <?php
- $camelia_header_socialicon = cs_get_option('camelia_header_socialicon');
- $camelia_header_contact = cs_get_option('camelia_header_contact');
- $enable_logo_image = cs_get_option('enable_logo_image');
- $camelia_img_logo = cs_get_option('camelia_img_logo');
- $camelia_img_logo_height = cs_get_option('camelia_img_logo_height');
- $camelia_text_logo = cs_get_option('camelia_text_logo');
- $enable_preloaded = cs_get_option('enable_preloaded');
- $enable_box_layout = cs_get_option('enable_box_layout');
- $camelia_header_script = cs_get_option('camelia_header_script');
- $camelia_body_script = cs_get_option('camelia_body_script');
- wp_head();
- echo$camelia_header_script;
- ?>
- </head>
- <body <?php body_class(); ?> >
- <?php echo $camelia_body_script; ?>
- <?php if($enable_preloaded == true) : ?>
- <!-- Preloader -->
- <?php endif; ?>
- <div id="page" class="site<?php if($enable_box_layout == true) : ?> camelia-box-layout <?php endif; ?>">
- <div class="header-area">
- <div class="container">
- <div class="row">
- <div class="col-md-6">
- <div class="header-left-icon">
- <ul>
- <?php
- if(!empty($camelia_header_socialicon)){
- foreach($camelia_header_socialicon as $socialicon){ ?>
- <li>
- <?php
- if(!empty($socialicon['camelia_header_icon_link'])){ ?>
- <a href="<?php echo $socialicon['camelia_header_icon_link'] ?>" target="_blank">
- <?php } else{ ?>
- <div>
- <?php }
- ?>
- <i class="<?php echo $socialicon['camelia_header_icon_field'] ?>"></i>
- <?php
- if(!empty($socialicon['camelia_header_icon_link'])){ ?>
- </a>
- <?php } else{ ?>
- </div>
- <?php }
- ?>
- </li>
- <?php }
- }
- ?>
- </ul>
- </div>
- </div>
- <div class="col-md-6">
- <div class="header-right-contect">
- <?php
- if(!empty($camelia_header_contact)){
- foreach($camelia_header_contact as $contact){ ?>
- <span class="mail">
- <?php
- if(!empty($contact['cotact_icon_link'])){ ?>
- <a href="<?php echo $contact['cotact_icon_link'] ?>" target="_blank">
- <?php } ?>
- <i class="<?php echo $contact['camelia_contact_icon_field'] ?>"></i>
- <?php echo $contact['camelia_contact_text_field'] ?>
- <?php
- if(!empty($contact['cotact_icon_link'])){ ?>
- </a>
- <?php } ?>
- </span>
- <?php }
- }
- ?>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- Main Menu -->
- <div class="container">
- <div class="row">
- <div class="col-md-4">
- <div class="logo">
- <h1 class="site-title">
- <a class="navbar-brand" href="<?php esc_url(home_url('/')); ?>">
- <?php if($enable_logo_image == true && !empty($camelia_img_logo)) : $img_logo_src = wp_get_attachment_image_src($camelia_img_logo, 'large', false) ; ?>
- <img style="max-height:<?php echo $camelia_img_logo_height; ?>px" src="<?php echo $img_logo_src[0]; ?>" alt="<?php echo bloginfo('name'); ?>">
- <?php else : ?>
- <?php if(!empty($camelia_text_logo)) { echo $camelia_text_logo; } else { bloginfo('name'); } ?>
- <?php endif; ?>
- </a>
- </h1>
- </div><!-- /.navbar-header -->
- </div>
- <div class="col-md-8">
- <div class="mainmenu">
- <?php
- wp_nav_menu(array(
- 'theme_location' => 'main_menu',
- 'menu_class' => 'nav navbar-nav stellarnav',
- 'menu_id' => 'main-nav',
- ));
- ?>
- </div>
- </div><!-- /.row -->
- </div><!-- /.row -->
- </div><!-- /.row -->
- <!-- Main Menu end -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement