Advertisement
Rameen

Untitled

Jul 12th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.73 KB | None | 0 0
  1. /* custom-style.php */
  2.  
  3.  
  4. <?php
  5. if ( ! function_exists( 'camelia_fonts_url' ) ) :
  6. /**
  7. * Register Google fonts.
  8. *
  9. * @return string Google fonts URL for the theme.
  10. */
  11. function camelia_fonts_url() {
  12. $fonts_url = '';
  13. $fonts = array();
  14.  
  15. $body_font_type = cs_get_option('body_font_type');
  16.  
  17. if(!empty($body_font_type)){
  18. $body_font_type_process = implode(",",$body_font_type);
  19.  
  20. }else {
  21. $body_font_type_process = '500';
  22. }
  23. $body_subsets = ':'.$body_font_type_process.'';
  24.  
  25. $header_font_type = cs_get_option('header_font_type');
  26.  
  27. if(!empty($header_font_type)){
  28. $header_font_type_process = implode(",",$header_font_type);
  29.  
  30. }else {
  31. $header_font_type_process = '700';
  32. }
  33.  
  34. $header_subsets = ':'.$header_font_type_process.'';
  35.  
  36. $camelia_body_font = cs_get_option('camelia_body_font') ['family'];
  37. $camelia_body_font .= $body_subsets;
  38.  
  39. $camelia_header_font = cs_get_option('camelia_header_font') ['family'];
  40. $camelia_header_font .= $header_subsets;
  41.  
  42. /* 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. */
  43. if ( 'off' !== esc_html_x( 'on', 'Karla font: on or off', 'camelia-crazycafe' ) ) {
  44. $fonts[] = $camelia_body_font;
  45. }
  46.  
  47. /* 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. */
  48. if ( 'off' !== esc_html_x( 'on', 'Lato font: on or off', 'camelia-crazycafe' ) ) {
  49. $fonts[] = $camelia_header_font;
  50. }
  51.  
  52. if ( $fonts ) {
  53. $fonts_url = add_query_arg( array(
  54. 'family' => urlencode( implode( '|', $fonts ) ),
  55. ), 'https://fonts.googleapis.com/css' );
  56. }
  57.  
  58. return $fonts_url;
  59. }
  60. endif;
  61.  
  62. /**
  63. * Enqueue scripts and styles.
  64. */
  65. function camelia_scripts() {
  66.  
  67. // Add custom fonts, used in the main stylesheet.
  68. wp_enqueue_style( 'camelia-google-fonts', camelia_fonts_url(), array(), null );
  69. }
  70.  
  71. add_action( 'wp_enqueue_scripts', 'camelia_scripts' );
  72.  
  73. function camelia_custom_css() {
  74.  
  75. wp_enqueue_style( 'camelia-custom-style', get_template_directory_uri().'/assets/css/custom-style.css');
  76.  
  77. $camelia_body_font = cs_get_option('camelia_body_font') ['family'];
  78. $camelia_header_font = cs_get_option('camelia_header_font') ['family'];
  79. $camelia_body_font_width = cs_get_option('camelia_body_font') ['variant'];
  80. $camelia_header_font_width = cs_get_option('camelia_header_font') ['variant'];
  81.  
  82. $enable_box_layout = cs_get_option('enable_box_layout');
  83. $body_bg_color = cs_get_option('body_bg_color');
  84. $body_bg = cs_get_option('body_bg');
  85. $body_bg_img_array = wp_get_attachment_image_src($body_bg, 'large', false);
  86. $body_bg_repeat = cs_get_option('body_bg_repeat');
  87. $body_bg_attachment = cs_get_option('body_bg_attachment');
  88. //var_dump($body_bg);
  89. $custom_css = '
  90. body {font-family: '.$camelia_body_font.'; font-weight: '.$camelia_body_font_width.'}
  91. h1, h2, h3, h4, h5, h6 {font-family: '.$camelia_header_font.'; font-weight: '.$camelia_header_font_width.'}
  92. ';
  93.  
  94. if($enable_box_layout == true){
  95. if(!empty($body_bg_color)){
  96. $custom_css .= '
  97. body{background-color : '.$body_bg_color.'}
  98. ';
  99. }
  100.  
  101. if(!empty($body_bg)){
  102. $custom_css .= '
  103. body{background-image : url('.$body_bg_img_array[0].') }
  104. ';
  105. }
  106.  
  107. if(!empty($body_bg_repeat)){
  108. $custom_css .= '
  109. body{background-repeat : '.$body_bg_repeat.'}
  110. ';
  111. }
  112.  
  113. if(!empty($body_bg_attachment)){
  114. $custom_css .= '
  115. body{background-attachment : '.$body_bg_attachment.'}
  116. ';
  117. }
  118. }
  119. wp_add_inline_style('camelia-custom-style',$custom_css);
  120. }
  121. add_action( 'wp_enqueue_scripts', 'camelia_custom_css' );
  122.  
  123.  
  124. /* CodeStar Option */
  125. // typography
  126.  
  127. $options[] = array(
  128. 'name' => 'camelia_typography_section',
  129. 'title' => 'Typography',
  130. 'icon' => 'fa fa-file-code-o',
  131. 'fields' => array(
  132. array(
  133. 'id' => 'camelia_body_font',
  134. 'type' => 'typography',
  135. 'title' => 'Body font',
  136. 'default' => array(
  137. 'family' => 'Roboto',
  138. 'variant' => 'regular',
  139. 'font' => 'google',
  140. ),
  141. ),
  142.  
  143. array(
  144. 'id' => 'body_font_type',
  145. 'type' => 'checkbox',
  146. 'title' => 'Body font type',
  147. 'options' => array(
  148. '100' => '100',
  149. '100i' => '100i',
  150. '300' => '300',
  151. '300i' => '300i',
  152. '400' => '400',
  153. '400i' => '400i',
  154. '500' => '500',
  155. '500i' => '500i',
  156. '700' => '700',
  157. '700i' => '700i',
  158. '900' => '900',
  159. '900i' => '900i',
  160. ),
  161. 'default' => array( '400', '400i', '700', '700i',)
  162. ),
  163.  
  164. array(
  165. 'id' => 'camelia_header_font',
  166. 'type' => 'typography',
  167. 'title' => 'Header font',
  168. 'default' => array(
  169. 'family' => 'Noto Serif',
  170. 'variant' => '700',
  171. 'font' => 'google',
  172. ),
  173. ),
  174.  
  175. array(
  176. 'id' => 'header_font_type',
  177. 'type' => 'checkbox',
  178. 'title' => 'Header font type',
  179. 'options' => array(
  180. '100' => '100',
  181. '100i' => '100i',
  182. '300' => '300',
  183. '300i' => '300i',
  184. '400' => '400',
  185. '400i' => '400i',
  186. '500' => '500',
  187. '500i' => '500i',
  188. '700' => '700',
  189. '700i' => '700i',
  190. '900' => '900',
  191. '900i' => '900i',
  192. ),
  193. 'default' => array( '400', '400i', '700', '700i',)
  194. ),
  195. )
  196. );
  197.  
  198. // style
  199.  
  200. $options[] = array(
  201. 'name' => 'camelia_style_setting',
  202. 'title' => 'Style Setting',
  203. 'icon' => 'fa fa-pencil-square-o',
  204. 'fields' => array(
  205.  
  206. array(
  207. 'id' => 'enable_preloaded',
  208. 'type' => 'switcher',
  209. 'title' => 'Enable Preloaded',
  210. 'default' => true
  211. ),
  212.  
  213. array(
  214. 'id' => 'enable_box_layout',
  215. 'type' => 'switcher',
  216. 'title' => 'Enable box layout',
  217. 'default' => false
  218. ),
  219.  
  220. array(
  221. 'id' => 'body_bg_color',
  222. 'type' => 'color_picker',
  223. 'title' => 'Body background color',
  224. 'dependency' => array( 'enable_box_layout', '==', 'true' ),
  225. ),
  226.  
  227. array(
  228. 'id' => 'body_bg',
  229. 'type' => 'image',
  230. 'title' => 'Body background image',
  231. 'dependency' => array( 'enable_box_layout', '==', 'true' ),
  232. ),
  233.  
  234. array(
  235. 'id' => 'body_bg_repeat',
  236. 'type' => 'select',
  237. 'title' => 'Body Background Repeat',
  238. 'options' => array(
  239. 'repeat' => 'Repeat',
  240. 'no-repeat' => 'No Repeat',
  241. 'cover' => 'Cover',
  242. ),
  243. 'default' => 'repeat',
  244. 'dependency' => array( 'enable_box_layout', '==', 'true' ),
  245. ),
  246.  
  247. array(
  248. 'id' => 'body_bg_attachment',
  249. 'type' => 'select',
  250. 'title' => 'Body Background Attachment',
  251. 'options' => array(
  252. 'fixed' => 'Fixed',
  253. 'scroll' => 'Scroll',
  254.  
  255. ),
  256. 'default' => 'fixed',
  257. 'dependency' => array( 'enable_box_layout', '==', 'true' ),
  258. ),
  259.  
  260. )
  261. );
  262.  
  263.  
  264.  
  265. /* Header.php for scripts option */
  266.  
  267. ?><!DOCTYPE html>
  268. <html <?php language_attributes(); ?>>
  269. <head>
  270. <meta charset="<?php bloginfo( 'charset' ); ?>">
  271. <meta name="viewport" content="width=device-width, initial-scale=1">
  272. <link rel="profile" href="http://gmpg.org/xfn/11">
  273.  
  274. <?php
  275.  
  276. $camelia_header_socialicon = cs_get_option('camelia_header_socialicon');
  277. $camelia_header_contact = cs_get_option('camelia_header_contact');
  278. $enable_logo_image = cs_get_option('enable_logo_image');
  279. $camelia_img_logo = cs_get_option('camelia_img_logo');
  280. $camelia_img_logo_height = cs_get_option('camelia_img_logo_height');
  281. $camelia_text_logo = cs_get_option('camelia_text_logo');
  282.  
  283. $enable_preloaded = cs_get_option('enable_preloaded');
  284. $enable_box_layout = cs_get_option('enable_box_layout');
  285.  
  286.  
  287. $camelia_header_script = cs_get_option('camelia_header_script');
  288. $camelia_body_script = cs_get_option('camelia_body_script');
  289.  
  290.  
  291.  
  292.  
  293. wp_head();
  294. echo$camelia_header_script;
  295.  
  296.  
  297.  
  298.  
  299. ?>
  300. </head>
  301.  
  302. <body <?php body_class(); ?> >
  303.  
  304. <?php echo $camelia_body_script; ?>
  305.  
  306. <?php if($enable_preloaded == true) : ?>
  307. <!-- Preloader -->
  308. <?php endif; ?>
  309.  
  310.  
  311. <div id="page" class="site<?php if($enable_box_layout == true) : ?> camelia-box-layout <?php endif; ?>">
  312.  
  313. <div class="header-area">
  314. <div class="container">
  315. <div class="row">
  316. <div class="col-md-6">
  317. <div class="header-left-icon">
  318. <ul>
  319.  
  320. <?php
  321. if(!empty($camelia_header_socialicon)){
  322. foreach($camelia_header_socialicon as $socialicon){ ?>
  323. <li>
  324. <?php
  325. if(!empty($socialicon['camelia_header_icon_link'])){ ?>
  326. <a href="<?php echo $socialicon['camelia_header_icon_link'] ?>" target="_blank">
  327.  
  328. <?php } else{ ?>
  329. <div>
  330. <?php }
  331. ?>
  332. <i class="<?php echo $socialicon['camelia_header_icon_field'] ?>"></i>
  333.  
  334. <?php
  335. if(!empty($socialicon['camelia_header_icon_link'])){ ?>
  336. </a>
  337.  
  338. <?php } else{ ?>
  339. </div>
  340. <?php }
  341. ?>
  342.  
  343. </li>
  344. <?php }
  345. }
  346.  
  347. ?>
  348.  
  349. </ul>
  350. </div>
  351. </div>
  352.  
  353. <div class="col-md-6">
  354. <div class="header-right-contect">
  355.  
  356.  
  357. <?php
  358. if(!empty($camelia_header_contact)){
  359. foreach($camelia_header_contact as $contact){ ?>
  360. <span class="mail">
  361. <?php
  362. if(!empty($contact['cotact_icon_link'])){ ?>
  363. <a href="<?php echo $contact['cotact_icon_link'] ?>" target="_blank">
  364.  
  365. <?php } ?>
  366.  
  367. <i class="<?php echo $contact['camelia_contact_icon_field'] ?>"></i>
  368. <?php echo $contact['camelia_contact_text_field'] ?>
  369.  
  370. <?php
  371. if(!empty($contact['cotact_icon_link'])){ ?>
  372. </a>
  373.  
  374. <?php } ?>
  375.  
  376. </span>
  377. <?php }
  378. }
  379.  
  380. ?>
  381.  
  382. </div>
  383. </div>
  384. </div>
  385.  
  386.  
  387.  
  388.  
  389. </div>
  390. </div>
  391.  
  392. <!-- Main Menu -->
  393. <div class="container">
  394. <div class="row">
  395. <div class="col-md-4">
  396. <div class="logo">
  397. <h1 class="site-title">
  398. <a class="navbar-brand" href="<?php esc_url(home_url('/')); ?>">
  399.  
  400.  
  401. <?php if($enable_logo_image == true && !empty($camelia_img_logo)) : $img_logo_src = wp_get_attachment_image_src($camelia_img_logo, 'large', false) ; ?>
  402. <img style="max-height:<?php echo $camelia_img_logo_height; ?>px" src="<?php echo $img_logo_src[0]; ?>" alt="<?php echo bloginfo('name'); ?>">
  403.  
  404. <?php else : ?>
  405. <?php if(!empty($camelia_text_logo)) { echo $camelia_text_logo; } else { bloginfo('name'); } ?>
  406. <?php endif; ?>
  407.  
  408.  
  409.  
  410.  
  411. </a>
  412. </h1>
  413. </div><!-- /.navbar-header -->
  414. </div>
  415.  
  416. <div class="col-md-8">
  417. <div class="mainmenu">
  418.  
  419. <?php
  420. wp_nav_menu(array(
  421. 'theme_location' => 'main_menu',
  422. 'menu_class' => 'nav navbar-nav stellarnav',
  423. 'menu_id' => 'main-nav',
  424. ));
  425. ?>
  426.  
  427. </div>
  428. </div><!-- /.row -->
  429. </div><!-- /.row -->
  430. </div><!-- /.row -->
  431.  
  432.  
  433.  
  434. <!-- Main Menu end -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement