rdusnr

Untitled

Oct 30th, 2017
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.33 KB | None | 0 0
  1. <?php
  2.  
  3. /***************************************************
  4. :: Header section render
  5. ***************************************************/
  6.  
  7. function kleo_show_header() {
  8. kleo_get_template_part( 'page-parts/header-top' );
  9. }
  10.  
  11. add_action( 'kleo_header', 'kleo_show_header', 12 );
  12.  
  13.  
  14. function kleo_show_side_menu() {
  15.  
  16. kleo_get_template_part( 'page-parts/header-side' );
  17. }
  18.  
  19. add_action( 'kleo_after_body', 'kleo_show_side_menu' );
  20.  
  21. if ( ! function_exists('kleo_show_page_title')) {
  22. /**
  23. * Render page title
  24. */
  25. function kleo_show_page_title() {
  26. if ( sq_option( 'page_title_title', true ) ) {
  27. echo '<h1>' . kleo_title() . '</h1>';
  28. }
  29. }
  30. }
  31.  
  32. add_action( 'kleo_page_title_section', 'kleo_show_page_title', 12 );
  33.  
  34. /**
  35. * Render page title tagline
  36. */
  37. function kleo_show_title_tagline() {
  38. if ( sq_option('page_title_tagline') ) {
  39. echo '<span>' . sq_option('page_title_tagline') .'</span>';
  40. }
  41. }
  42.  
  43. add_action( 'kleo_page_title_section', 'kleo_show_title_tagline', 14 );
  44.  
  45. /**
  46. * Render page breadcrumb in title section
  47. */
  48. function kleo_show_breadcrumb() {
  49. if (sq_option( 'page_title_breadcrumb', true, true )) {
  50.  
  51. kleo_breadcrumb( array( 'container' => 'ol', 'separator' => '', 'show_browse' => false ) );
  52.  
  53. }
  54. }
  55.  
  56. add_action( 'kleo_page_title_section', 'kleo_show_breadcrumb', 16 );
  57.  
  58. /***************************************************
  59. :: Add body classes
  60. ***************************************************/
  61.  
  62. add_filter( 'body_class','kleo_body_classes' );
  63.  
  64. /*
  65. * Adds specific classes to body element
  66. *
  67. * @param array $classes
  68. * @return array
  69. * @since 1.0
  70. */
  71. function kleo_body_classes( $classes = array() ) {
  72.  
  73. if( is_admin_bar_showing() && sq_option( 'admin_bar', 1 ) == 1 ) {
  74. $classes[] = 'adminbar-enable';
  75. }
  76.  
  77. //page transition
  78. if ( sq_option( 'page_loader', false ) ) {
  79. $classes[] = 'page-transition';
  80. }
  81.  
  82. //side-menu cookie
  83. if (sq_option('header_sidemenu', true, true)) {
  84. if ( sq_option( 'header_sidemenu_state', 'cookie' ) == 'cookie' ) {
  85. if ( isset( $_COOKIE['kleo-side'] ) && $_COOKIE['kleo-side'] == 'open' ) {
  86. $classes[] = 'sidemenu-is-open';
  87. $classes[] = 'force-close-sidemenu';
  88. $classes[] = 'sidemenu-saved';
  89. }
  90. } elseif ( sq_option( 'header_sidemenu_state', 'cookie' ) == 'narrow' ) {
  91. $classes[] = 'sidemenu-is-open';
  92. $classes[] = 'force-close-sidemenu';
  93. }
  94. } else {
  95. $classes[] = 'no-sidemenu';
  96. }
  97.  
  98. //is customizer
  99. if (is_customize_preview()) {
  100. $classes[] = 'customize-preview';
  101. }
  102.  
  103. if ( sq_option( 'header_status', true, true ) == false ) {
  104. $classes[] = 'header-hidden';
  105. }
  106.  
  107. return $classes;
  108. }
  109.  
  110.  
  111. /***************************************************
  112. :: Dynamic variables
  113. ***************************************************/
  114.  
  115. add_filter( 'kleo_get_dynamic_variables', 'kleo_base_dynamic_variables' );
  116. function kleo_base_dynamic_variables( $variables ) {
  117.  
  118. foreach (Kleo::get_config('styling_variables') as $slug => $name) {
  119. if (sq_option('header_style_' . str_replace('-', '_', $slug))) {
  120. $variables['header-' . $slug] = sq_option('header_style_' . str_replace('-', '_', $slug));
  121. }
  122.  
  123. if (sq_option('default_style_' . str_replace('-', '_', $slug))) {
  124. $variables['default-' . $slug] = sq_option('default_style_' . str_replace('-', '_', $slug));
  125. }
  126.  
  127. if (sq_option('sidemenu_style_' . str_replace('-', '_', $slug))) {
  128. $variables['sidemenu-' . $slug] = sq_option('sidemenu_style_' . str_replace('-', '_', $slug));
  129. }
  130. }
  131.  
  132. if (sq_option('header_style_mobile_background_color')) {
  133. $variables['header-mobile-background-color'] = sq_option('header_style_mobile_background_color');
  134. }
  135.  
  136.  
  137. if (sq_option('font_headings')) {
  138. $variables['heading-font'] = sq_option('font_headings');
  139. }
  140. if (sq_option('font_text')) {
  141. $variables['body-font'] = sq_option('font_text');
  142. }
  143.  
  144. $headings_array = array( 'h1' , 'h2', 'h3', 'h4', 'h5', 'h6' );
  145. foreach ( $headings_array as $heading ) {
  146. if ( sq_option('font_size_' . $heading ) ) {
  147. $variables['font-size-' . $heading] = round( sq_option( 'font_size_' . $heading ) / 16, 2 ) . 'em';
  148. }
  149. }
  150.  
  151. if (sq_option('font_size_base')) {
  152. $variables['font-size-base'] = round(sq_option('font_size_base') / 16, 2) . 'rem';
  153. $variables['font-size-content'] = round(sq_option('font_size_base') / 16, 2) . 'em';
  154. }
  155.  
  156. if ( sq_option( 'header_height', '' ) ) {
  157. $variables['header-height'] = kleo_set_default_unit( sq_option('header_height') );
  158. }
  159. if ( sq_option('container_padding_left') ) {
  160. $variables['container-padding-left'] = kleo_set_default_unit(sq_option('container_padding_left') );
  161. }
  162. if ( sq_option('container_padding_right') ) {
  163. $variables['container-padding-right'] = kleo_set_default_unit( sq_option( 'container_padding_right' ) );
  164. }
  165. if ( sq_option('side_padding_left') ) {
  166. $variables['sidemenu-padding-left'] = kleo_set_default_unit( sq_option('side_padding_left'));
  167. }
  168. if ( sq_option('side_padding_right') ) {
  169. $variables['sidemenu-padding-right'] = kleo_set_default_unit( sq_option('side_padding_right'));
  170. }
  171. if ( sq_option('logo_padding_left') ) {
  172. $variables['logo-padding-left'] = kleo_set_default_unit( sq_option('logo_padding_left'));
  173. }
  174.  
  175.  
  176. if ( sq_option('sidemenu_width') ) {
  177. $variables['sidemenu-width'] = kleo_set_default_unit( sq_option('sidemenu_width') );
  178. }
  179.  
  180. if ( sq_option('sidemenu_col_width') ) {
  181. $variables['sidemenu-collapsed-width'] = kleo_set_default_unit( sq_option('sidemenu_col_width') );
  182. }
  183.  
  184. if ( sq_option('sidemenu_header_bg') ) {
  185. $variables['sidemenu-header-background-color'] = sq_option('sidemenu_header_bg');
  186. }
  187.  
  188. if ( sq_option('sidemenu_font_size') ) {
  189. $variables['menu-font-size'] = kleo_set_default_unit( sq_option('sidemenu_font_size') );
  190. }
  191.  
  192. if ( sq_option('sidemenu_submenu_font_size') ) {
  193. $variables['submenu-font-size'] = kleo_set_default_unit( sq_option('sidemenu_submenu_font_size') );
  194. }
  195.  
  196. if ( sq_option('blog_full_bg', '') != '' ) {
  197. $variables['blog-full-hero-background'] = sq_option('blog_full_bg', '');
  198. }
  199.  
  200. if ( sq_option('sidemenu_menu_active_bg', '') != '' ) {
  201. $variables['sidemenu-menu-background'] = sq_option('sidemenu_menu_active_bg', '');
  202. }
  203. if ( sq_option('sidemenu_submenu_active_bg', '') != '' ) {
  204. $variables['sidemenu-active-submenu-background'] = sq_option('sidemenu_submenu_active_bg', '');
  205. }
  206.  
  207. //sidemenu_menu_active_bg
  208. //sidemenu_submenu_active_bg
  209.  
  210.  
  211.  
  212. return $variables;
  213. }
  214.  
  215.  
  216. /***************************************************
  217. :: Theme options
  218. ***************************************************/
  219.  
  220. add_filter( 'kleo_theme_settings', 'kleo_base_settings' );
  221.  
  222. function kleo_base_settings( $kleo )
  223. {
  224. //
  225. // Settings Sections
  226. //
  227.  
  228. $kleo['panels']['kleo_panel_styling'] = array(
  229. 'title' => esc_html__('Styling', 'buddyapp'),
  230. 'description' => __('Styling & fonts settings', 'buddyapp'),
  231. 'priority' => 10
  232. );
  233.  
  234.  
  235. $kleo['sec']['kleo_section_layout'] = array(
  236. 'title' => esc_html__( 'Layout', 'buddyapp' ),
  237. 'priority' => 8
  238. );
  239. $kleo['sec']['kleo_section_styling'] = array(
  240. 'title' => esc_html__('Main section Colors', 'buddyapp'),
  241. 'panel' => 'kleo_panel_styling',
  242. 'priority' => 10
  243. );
  244. $kleo['sec']['kleo_section_fonts'] = array(
  245. 'title' => esc_html__('Fonts', 'buddyapp'),
  246. 'panel' => 'kleo_panel_styling',
  247. 'priority' => 10
  248. );
  249. $kleo['sec']['kleo_section_logo'] = array(
  250. 'title' => esc_html__('Logo', 'buddyapp'),
  251. 'priority' => 13
  252. );
  253. $kleo['sec']['kleo_section_blog'] = array(
  254. 'title' => esc_html__('Blog', 'buddyapp'),
  255. 'priority' => 14
  256. );
  257.  
  258.  
  259. //
  260. // Layout
  261. //
  262.  
  263.  
  264. $kleo['set'][] = array(
  265. 'id' => 'site_layout',
  266. 'type' => 'select',
  267. 'title' => esc_html__('Site Layout', 'buddyapp'),
  268. 'choices' => array(
  269. 'full' => esc_html__('Full', 'buddyapp'),
  270. 'right' => esc_html__('Right sidebar', 'buddyapp'),
  271. 'left' => esc_html__('Left sidebar', 'buddyapp')
  272. ),
  273. 'default' => 'full',
  274. 'section' => 'kleo_section_layout',
  275. 'customizer' => true,
  276. 'transport' => 'refresh'
  277. );
  278.  
  279.  
  280. $kleo['set'][] = array(
  281. 'id' => 'page_loader',
  282. 'type' => 'switch',
  283. 'title' => esc_html__('Page load transition', 'buddyapp'),
  284. 'default' => '0',
  285. 'section' => 'kleo_section_layout',
  286. 'description' => esc_html__('Have a nice page load effect', 'buddyapp'),
  287. 'customizer' => true,
  288. 'transport' => 'refresh'
  289. );
  290. $kleo['set'][] = array(
  291. 'id' => 'container_padding_left',
  292. 'type' => 'text',
  293. 'title' => esc_html__( "Main container left padding ", "buddyapp" ),
  294. 'default' => '40',
  295. 'section' => 'kleo_section_layout',
  296. 'description' => esc_html__('Left padding in pixels.(default 40)', 'buddyapp') ,
  297. 'customizer' => true,
  298. 'transport' => 'refresh'
  299. );
  300. $kleo['set'][] = array(
  301. 'id' => 'container_padding_right',
  302. 'type' => 'text',
  303. 'title' => esc_html__( "Main container right padding", "buddyapp" ),
  304. 'default' => '40',
  305. 'section' => 'kleo_section_layout',
  306. 'description' => esc_html__('Right padding in pixels.(default 40)', 'buddyapp') ,
  307. 'customizer' => true,
  308. 'transport' => 'refresh'
  309. );
  310.  
  311.  
  312.  
  313. //
  314. // Styling.
  315. //
  316.  
  317. $kleo['set'][] = array(
  318. 'id' => 'font_headings',
  319. 'type' => 'gfont',
  320. 'title' => esc_html__('Headings font', 'buddyapp'),
  321. 'default' => '',
  322. 'section' => 'kleo_section_fonts',
  323. 'description' => esc_html__('Font for the h1, h2, etc. font', 'buddyapp'),
  324. 'customizer' => true,
  325. 'transport' => 'refresh'
  326. );
  327.  
  328. $kleo['set'][] = array(
  329. 'id' => 'font_text',
  330. 'type' => 'gfont',
  331. 'title' => esc_html__('Text font', 'buddyapp'),
  332. 'default' => '',
  333. 'section' => 'kleo_section_fonts',
  334. 'description' => esc_html__('Font for the text on your site', 'buddyapp'),
  335. 'customizer' => true,
  336. 'transport' => 'refresh'
  337. );
  338.  
  339. $headings_array = array( 'h1' => 30 , 'h2' => 24, 'h3' => 18, 'h4' => 18, 'h5' => 16, 'h6' => 14 );
  340.  
  341. $kleo['set'][] = array(
  342. 'id' => 'font_size_base',
  343. 'type' => 'text',
  344. 'title' => esc_html__( "Body text font size", "buddyapp" ),
  345. 'default' => 16,
  346. 'section' => 'kleo_section_fonts',
  347. 'description' => esc_html__('Font size in pixels', 'buddyapp') . '. Default 16' ,
  348. 'customizer' => true,
  349. 'transport' => 'refresh'
  350. );
  351.  
  352.  
  353. foreach ( $headings_array as $heading => $default ) {
  354. $kleo['set'][] = array(
  355. 'id' => 'font_size_' . $heading,
  356. 'type' => 'text',
  357. 'title' => strtoupper( $heading ) . ' ' . esc_html__( "Font size", "buddyapp" ),
  358. 'default' => $default,
  359. 'section' => 'kleo_section_fonts',
  360. 'description' => esc_html__('Font size in pixels', 'buddyapp') . '. Default ' . $default,
  361. 'customizer' => true,
  362. 'transport' => 'refresh'
  363. );
  364. }
  365.  
  366. foreach (Kleo::get_config( 'styling_variables' ) as $slug => $name) {
  367. $kleo['set'][] = array(
  368. 'id' => 'default_style_' . str_replace('-', '_', $slug),
  369. 'type' => 'color',
  370. 'title' => $name,
  371. 'default' => '',
  372. 'section' => 'kleo_section_styling',
  373. 'customizer' => true,
  374. 'transport' => 'refresh'
  375. );
  376. }
  377.  
  378. //
  379. // Header.
  380. //
  381.  
  382.  
  383. $kleo['panels']['kleo_panel_header'] = array(
  384. 'title' => esc_html__('Header', 'buddyapp'),
  385. 'priority' => 12
  386. );
  387. $kleo['sec']['kleo_section_header'] = array(
  388. 'title' => esc_html__('Header settings', 'buddyapp'),
  389. 'panel' => 'kleo_panel_header',
  390. 'priority' => 12
  391. );
  392. $kleo['sec']['kleo_section_header_styling'] = array(
  393. 'title' => esc_html__('Header Styling', 'buddyapp'),
  394. 'panel' => 'kleo_panel_header',
  395. 'priority' => 12
  396. );
  397. $kleo['sec']['kleo_section_header_sidemenu'] = array(
  398. 'title' => esc_html__('Side-Menu Styling', 'buddyapp'),
  399. 'panel' => 'kleo_panel_header',
  400. 'priority' => 12
  401. );
  402.  
  403.  
  404. $kleo['set'][] = array(
  405. 'id' => 'header_status',
  406. 'type' => 'switch',
  407. 'title' => esc_html__( 'Display Header', 'buddyapp' ),
  408. 'default' => '1',
  409. 'section' => 'kleo_section_header',
  410. 'description' => esc_html__('Enable/disable the header from your site', 'buddyapp'),
  411. 'customizer' => true,
  412. 'transport' => 'refresh'
  413. );
  414. $kleo['set'][] = array(
  415. 'id' => 'header_height',
  416. 'type' => 'text',
  417. 'title' => esc_html__( 'Header Height' , 'buddyapp' ),
  418. 'default' => '',
  419. 'section' => 'kleo_section_header',
  420. 'description' => esc_html__('Set your top header height in pixels(default 60)', 'buddyapp'),
  421. 'customizer' => true,
  422. 'transport' => 'refresh',
  423. );
  424.  
  425. $kleo['set'][] = array(
  426. 'id' => 'header_right_logic',
  427. 'type' => 'select',
  428. 'title' => esc_html__( 'Right menu location display logic' , 'buddyapp' ),
  429. 'default' => 'default',
  430. 'choices' => array(
  431. 'default' => 'Just for logged in, under my Profile image',
  432. 'replace' => 'My menu will display horizontally for everyone'
  433. ),
  434. 'section' => 'kleo_section_header',
  435. 'description' => esc_html__('How to render the assigned custom menu. First option will show a login button for guests instead of your menu.', 'buddyapp'),
  436. 'customizer' => true,
  437. 'transport' => 'refresh'
  438. );
  439.  
  440. $kleo['set'][] = array(
  441. 'id' => 'header_search',
  442. 'type' => 'switch',
  443. 'title' => esc_html__( 'Display search in header', 'buddyapp' ),
  444. 'default' => '1',
  445. 'section' => 'kleo_section_header',
  446. 'description' => esc_html__('Enable/disable the search form in the header area', 'buddyapp'),
  447. 'customizer' => true,
  448. 'transport' => 'refresh'
  449. );
  450.  
  451. $kleo['set'][] = array(
  452. 'id' => 'search_context',
  453. 'type' => 'multi-select',
  454. 'title' => esc_html__( 'Search context' , 'buddyapp' ),
  455. 'default' => '',
  456. 'choices' => kleo_search_scope_post_types(),
  457. 'section' => 'kleo_section_header',
  458. 'description' => esc_html__('What to search for.', 'buddyapp'),
  459. 'customizer' => true,
  460. 'transport' => 'postMessage',
  461. 'condition' => array( 'header_search', 1 )
  462. );
  463.  
  464. $kleo['set'][] = array(
  465. 'id' => 'menu_dropdown',
  466. 'type' => 'select',
  467. 'title' => esc_html__( 'Dropdown menu trigger' , 'buddyapp' ),
  468. 'default' => 'default',
  469. 'choices' => array(
  470. 'hover' => 'On Hover',
  471. 'click' => 'On Arrow click'
  472. ),
  473. 'section' => 'kleo_section_header',
  474. 'description' => esc_html__('How to open the header sub-menus.', 'buddyapp'),
  475. 'customizer' => true,
  476. 'transport' => 'refresh'
  477. );
  478.  
  479. //default menu icon
  480. $icon = Kleo::get_config( 'menu_icon_default' );
  481. $kleo['set'][] = array(
  482. 'id' => 'menu_icon',
  483. 'type' => 'select',
  484. 'title' => esc_html__( 'Default Menu icon' , 'buddyapp' ),
  485. 'default' => $icon,
  486. 'choices' => kleo_icons_array(),
  487. 'section' => 'kleo_section_header',
  488. 'customizer' => true,
  489. 'transport' => 'refresh'
  490. );
  491.  
  492.  
  493. $kleo['panels']['kleo_panel_side'] = array(
  494. 'title' => esc_html__('Sidemenu', 'buddyapp'),
  495. 'priority' => 13
  496. );
  497. $kleo['sec']['kleo_section_side'] = array(
  498. 'title' => esc_html__('Sidemenu settings', 'buddyapp'),
  499. 'panel' => 'kleo_panel_side',
  500. 'priority' => 13
  501. );
  502. $kleo['sec']['kleo_section_side_styling'] = array(
  503. 'title' => esc_html__('Sidemenu Styling', 'buddyapp'),
  504. 'panel' => 'kleo_panel_side',
  505. 'priority' => 13
  506. );
  507.  
  508.  
  509. $kleo['set'][] = array(
  510. 'id' => 'header_sidemenu',
  511. 'type' => 'switch',
  512. 'title' => esc_html__( 'Sidemenu enabled', 'buddyapp' ),
  513. 'default' => '1',
  514. 'section' => 'kleo_section_side',
  515. 'description' => esc_html__('Enable/disable left sidemenu area', 'buddyapp'),
  516. 'customizer' => true,
  517. 'transport' => 'refresh'
  518. );
  519.  
  520. $kleo['set'][] = array(
  521. 'id' => 'sidemenu_icons',
  522. 'type' => 'switch',
  523. 'title' => esc_html__( 'Show sidemenu icons', 'buddyapp' ),
  524. 'default' => '1',
  525. 'section' => 'kleo_section_side',
  526. 'description' => esc_html__('Enable of disable left side menu icons', 'buddyapp'),
  527. 'customizer' => true,
  528. 'transport' => 'refresh'
  529. );
  530.  
  531. $kleo['set'][] = array(
  532. 'id' => 'sidemenu_width',
  533. 'type' => 'text',
  534. 'title' => esc_html__( 'Sidemenu Width' , 'buddyapp' ),
  535. 'default' => '',
  536. 'section' => 'kleo_section_side',
  537. 'description' => esc_html__('Set sidemenu width in pixels(default 250px).', 'buddyapp'),
  538. 'customizer' => true,
  539. 'transport' => 'refresh',
  540. 'condition' => array( 'header_sidemenu', 1 )
  541. );
  542.  
  543. $kleo['set'][] = array(
  544. 'id' => 'sidemenu_col_width',
  545. 'type' => 'text',
  546. 'title' => esc_html__( 'Sidemenu Collapsed Width' , 'buddyapp' ),
  547. 'default' => '',
  548. 'section' => 'kleo_section_side',
  549. 'description' => esc_html__('Set width when closed(default 60px).', 'buddyapp'),
  550. 'customizer' => true,
  551. 'transport' => 'refresh',
  552. 'condition' => array( 'header_sidemenu', 1 )
  553. );
  554.  
  555. $kleo['set'][] = array(
  556. 'id' => 'side_padding_left',
  557. 'type' => 'text',
  558. 'title' => esc_html__( 'Sidemenu Padding left' , 'buddyapp' ),
  559. 'default' => '',
  560. 'section' => 'kleo_section_side',
  561. 'description' => esc_html__('Set left padding in pixels(default 20).', 'buddyapp'),
  562. 'customizer' => true,
  563. 'transport' => 'refresh',
  564. 'condition' => array( 'header_sidemenu', 1 )
  565. );
  566. $kleo['set'][] = array(
  567. 'id' => 'side_padding_right',
  568. 'type' => 'text',
  569. 'title' => esc_html__( 'Sidemenu Padding right' , 'buddyapp' ),
  570. 'default' => '',
  571. 'section' => 'kleo_section_side',
  572. 'description' => esc_html__('Set right padding in pixels(default 20)', 'buddyapp'),
  573. 'customizer' => true,
  574. 'transport' => 'refresh',
  575. 'condition' => array( 'header_sidemenu', 1 )
  576. );
  577.  
  578. $kleo['set'][] = array(
  579. 'id' => 'logo_padding_left',
  580. 'type' => 'text',
  581. 'title' => esc_html__( 'Logo Padding left' , 'buddyapp' ),
  582. 'default' => '',
  583. 'section' => 'kleo_section_side',
  584. 'description' => esc_html__('Set left padding for logo in pixels(default 10).', 'buddyapp'),
  585. 'customizer' => true,
  586. 'transport' => 'refresh',
  587. 'condition' => array( 'header_sidemenu', 1 )
  588. );
  589.  
  590. $kleo['set'][] = array(
  591. 'id' => 'header_sidemenu_state',
  592. 'type' => 'select',
  593. 'title' => esc_html__( 'Sidemenu Desktop state' , 'buddyapp' ),
  594. 'default' => 'cookie',
  595. 'choices' => array(
  596. 'cookie' => 'Cookie based. Opened by default.',
  597. 'open' => 'Opened',
  598. 'narrow' => 'Narrowed'
  599. ),
  600. 'section' => 'kleo_section_side',
  601. 'description' => esc_html__('How to show the left sidemenu by default on desktop devices. Cookie based uses last open state before browser refresh.', 'buddyapp'),
  602. 'customizer' => true,
  603. 'transport' => 'refresh',
  604. 'condition' => array( 'header_sidemenu', 1 )
  605. );
  606.  
  607. $kleo['set'][] = array(
  608. 'id' => 'header_bottom_text',
  609. 'type' => 'textarea',
  610. 'title' => esc_html__( 'Bottom Text' , 'buddyapp' ),
  611. 'default' => Kleo::get_config( 'footer_text' ),
  612. 'section' => 'kleo_section_side',
  613. 'description' => esc_html__('Bottom text on side menu', 'buddyapp'),
  614. 'customizer' => true,
  615. 'transport' => 'refresh',
  616. 'condition' => array( 'header_sidemenu', 1 )
  617. );
  618.  
  619. $styling_variables = Kleo::get_config('styling_variables');
  620. foreach ( $styling_variables as $slug => $name ) {
  621. $kleo['set'][] = array(
  622. 'id' => 'header_style_' . str_replace('-', '_', $slug),
  623. 'type' => 'color',
  624. 'title' => 'Header ' . $name,
  625. 'default' => '',
  626. 'section' => 'kleo_section_header_styling',
  627. 'customizer' => true,
  628. 'transport' => 'refresh'
  629. );
  630. }
  631.  
  632. //mobile bg color
  633. $kleo['set'][] = array(
  634. 'id' => 'header_style_mobile_background_color',
  635. 'type' => 'color',
  636. 'title' => esc_html__('Mobile background color', 'buddyapp'),
  637. 'default' => '',
  638. 'section' => 'kleo_section_header_styling',
  639. 'customizer' => true,
  640. 'transport' => 'refresh'
  641. );
  642.  
  643.  
  644. $kleo['set'][] = array(
  645. 'id' => 'sidemenu_font_size',
  646. 'type' => 'text',
  647. 'title' => 'Menu Font size',
  648. 'default' => '',
  649. 'section' => 'kleo_section_side_styling',
  650. 'description' => 'Set font size in px,em. Default 14px',
  651. 'customizer' => true,
  652. 'transport' => 'refresh'
  653. );
  654.  
  655. $kleo['set'][] = array(
  656. 'id' => 'sidemenu_submenu_font_size',
  657. 'type' => 'text',
  658. 'title' => 'Sub-Menu Font size',
  659. 'default' => '',
  660. 'section' => 'kleo_section_side_styling',
  661. 'description' => 'Set font size in px,em. Default 14px',
  662. 'customizer' => true,
  663. 'transport' => 'refresh'
  664. );
  665.  
  666. // Sidemenu
  667. foreach (Kleo::get_config('styling_variables') as $slug => $name) {
  668. $kleo['set'][] = array(
  669. 'id' => 'sidemenu_style_' . str_replace('-', '_', $slug),
  670. 'type' => 'color',
  671. 'title' => 'Sidemenu ' . $name,
  672. 'default' => '',
  673. 'section' => 'kleo_section_side_styling',
  674. 'customizer' => true,
  675. 'transport' => 'refresh'
  676. );
  677. }
  678.  
  679. $kleo['set'][] = array(
  680. 'id' => 'sidemenu_header_bg',
  681. 'type' => 'color',
  682. 'title' => 'Sidemenu Logo Background',
  683. 'default' => '',
  684. 'section' => 'kleo_section_side_styling',
  685. 'customizer' => true,
  686. 'transport' => 'refresh'
  687. );
  688.  
  689. $kleo['set'][] = array(
  690. 'id' => 'sidemenu_menu_active_bg',
  691. 'type' => 'color',
  692. 'title' => 'Sidemenu Active Menu Background',
  693. 'default' => '',
  694. 'section' => 'kleo_section_side_styling',
  695. 'customizer' => true,
  696. 'transport' => 'refresh'
  697. );
  698. $kleo['set'][] = array(
  699. 'id' => 'sidemenu_submenu_active_bg',
  700. 'type' => 'color',
  701. 'title' => 'Sidemenu Active Sub-Menu Background',
  702. 'default' => '',
  703. 'section' => 'kleo_section_side_styling',
  704. 'customizer' => true,
  705. 'transport' => 'refresh'
  706. );
  707.  
  708. //
  709. // Logo
  710. //
  711.  
  712. $kleo['set'][] = array(
  713. 'id' => 'logo',
  714. 'type' => 'image',
  715. 'title' => esc_html__('Logo Image', 'buddyapp'),
  716. 'default' => Kleo::get_config('logo_default'),
  717. 'section' => 'kleo_section_logo',
  718. 'description' => esc_html__('Used on dark backgrounds', 'buddyapp'),
  719. 'customizer' => true,
  720. 'transport' => 'refresh'
  721. );
  722.  
  723. $kleo['set'][] = array(
  724. 'id' => 'logo_retina',
  725. 'type' => 'image',
  726. 'title' => esc_html__('Retina Logo Image', 'buddyapp'),
  727. 'default' => '',
  728. 'section' => 'kleo_section_logo',
  729. 'customizer' => true,
  730. 'transport' => 'postMessage'
  731. );
  732.  
  733. $kleo['set'][] = array(
  734. 'id' => 'logo_dark',
  735. 'type' => 'image',
  736. 'title' => esc_html__('Dark Logo Image', 'buddyapp'),
  737. 'default' => Kleo::get_config('logo_dark_default'),
  738. 'section' => 'kleo_section_logo',
  739. 'description' => esc_html__('Used on white backgrounds', 'buddyapp'),
  740. 'customizer' => true,
  741. 'transport' => 'refresh'
  742. );
  743.  
  744. $kleo['set'][] = array(
  745. 'id' => 'logo_dark_retina',
  746. 'type' => 'image',
  747. 'title' => esc_html__( 'Retina Dark Logo Image', 'buddyapp' ),
  748. 'default' => '',
  749. 'section' => 'kleo_section_logo',
  750. 'customizer' => true,
  751. 'transport' => 'postMessage'
  752. );
  753.  
  754. $kleo['set'][] = array(
  755. 'id' => 'logo_mini',
  756. 'type' => 'image',
  757. 'title' => esc_html__( 'Logo Mini Image', 'buddyapp' ),
  758. 'default' => Kleo::get_config( 'logo_mini_default' ),
  759. 'section' => 'kleo_section_logo',
  760. 'description' => esc_html__('Used when side menu is minimized', 'buddyapp'),
  761. 'customizer' => true,
  762. 'transport' => 'refresh'
  763. );
  764.  
  765. $kleo['set'][] = array(
  766. 'id' => 'logo_mini_retina',
  767. 'type' => 'image',
  768. 'title' => esc_html__( 'Retina Logo Mini Image', 'buddyapp' ),
  769. 'default' => '',
  770. 'section' => 'kleo_section_logo',
  771. 'customizer' => true,
  772. 'transport' => 'postMessage'
  773. );
  774.  
  775.  
  776. //Blog
  777.  
  778. $kleo['set'][] = array(
  779. 'id' => 'blog_layout',
  780. 'type' => 'select',
  781. 'title' => esc_html__( 'Blog Layout', 'buddyapp' ),
  782. 'default' => 'default',
  783. 'choices' => array( 'default' => 'Site Default', 'full' => 'Full', 'right' => 'Right sidebar', 'left' => 'Left sidebar'),
  784. 'section' => 'kleo_section_blog',
  785. 'customizer' => true,
  786. 'transport' => 'refresh'
  787. );
  788.  
  789. $kleo['set'][] = array(
  790. 'id' => 'blog_style',
  791. 'type' => 'select',
  792. 'title' => esc_html__( 'Blog Style', 'buddyapp' ),
  793. 'default' => 'standard',
  794. 'choices' => array( 'standard' => 'Standard', 'full' => 'Full'),
  795. 'section' => 'kleo_section_blog',
  796. 'customizer' => true,
  797. 'transport' => 'refresh'
  798. );
  799.  
  800. $kleo['set'][] = array(
  801. 'id' => 'blog_full_bg',
  802. 'type' => 'color',
  803. 'title' => 'Full Style - Article media Background ',
  804. 'default' => '',
  805. 'section' => 'kleo_section_blog',
  806. 'customizer' => true,
  807. 'transport' => 'refresh',
  808. 'description' => __('Background color for the Full Style Blog article page', 'kleo_framework'),
  809. 'condition' => array( 'blog_style', 'full' )
  810. );
  811.  
  812. $kleo['set'][] = array(
  813. 'id' => 'blog_meta_elements',
  814. 'type' => 'multi-select',
  815. 'title' => __('Meta Fields', 'kleo_framework'),
  816. 'description' => __('What meta fields do you want displayed?', 'kleo_framework'),
  817. 'choices' => Kleo::get_config('blog_meta_elements'),
  818. 'default' => Kleo::get_config('blog_meta_defaults'),
  819. 'section' => 'kleo_section_blog',
  820. 'customizer' => true,
  821. 'transport' => 'refresh'
  822. );
  823.  
  824. //blog_get_image - switch
  825. $kleo['set'][] = array(
  826. 'id' => 'blog_get_image',
  827. 'type' => 'switch',
  828. 'title' => esc_html__( 'Get image from post content', 'buddyapp' ),
  829. 'default' => '1',
  830. 'section' => 'kleo_section_blog',
  831. 'description' => esc_html__('If no featured image was added, get it from the post content', 'buddyapp'),
  832. 'customizer' => true,
  833. 'transport' => 'refresh'
  834. );
  835.  
  836. //blog_default_image - image
  837. $kleo['set'][] = array(
  838. 'id' => 'blog_default_image',
  839. 'type' => 'image',
  840. 'title' => esc_html__( 'Default Post Image', 'buddyapp' ),
  841. 'default' => '',
  842. 'section' => 'kleo_section_blog',
  843. 'description' => esc_html__('Used when post has no featured image', 'buddyapp'),
  844. 'customizer' => true,
  845. 'transport' => 'postMessage'
  846. );
  847.  
  848. //post_media_status
  849. $kleo['set'][] = array(
  850. 'id' => 'post_media_status',
  851. 'type' => 'select',
  852. 'title' => esc_html__( 'Show featured image on post page', 'buddyapp' ),
  853. 'default' => '1',
  854. 'choices' => array( '1' => 'Yes', '0' => 'No'),
  855. 'section' => 'kleo_section_blog',
  856. 'customizer' => true,
  857. 'transport' => 'refresh'
  858. );
  859.  
  860. return $kleo;
  861. }
  862.  
  863. /* Get post types for Search scope */
  864. function kleo_search_scope_post_types() {
  865. $scope_atts = array();
  866. $scope_atts['extra'] = array();
  867. if (function_exists('bp_is_active')) {
  868. $scope_atts['extra']['members'] = 'Members';
  869. $scope_atts['extra']['groups'] = 'Groups';
  870. }
  871. $scope_atts['extra']['post'] = 'Posts';
  872. $scope_atts['extra']['page'] = 'Pages';
  873. $scope_atts['exclude'] = array('topic', 'reply');
  874.  
  875. return kleo_post_types( $scope_atts );
  876. }
  877.  
  878. /***************************************************
  879. :: Layout
  880. ***************************************************/
  881.  
  882. Kleo::set_config( 'site_layout_default', 'full' );
  883. Kleo::set_config( 'blog_layout_default', 'default' );
  884.  
  885.  
  886. if ( ! function_exists( 'kleo_prepare_layout' ) ) {
  887. /**
  888. * Prepare site layout with different customizations
  889. * @global string $kleo_custom_logo
  890. */
  891. function kleo_prepare_layout() {
  892.  
  893. //Change the template
  894. $layout = sq_option( 'site_layout', Kleo::get_config('site_layout_default') );
  895.  
  896. if( is_single() ) {
  897. if ( get_cfield( 'post_layout' ) && get_cfield('post_layout') != 'default' ) {
  898. $layout = get_cfield('post_layout');
  899. } else {
  900. if ( sq_option( 'blog_layout', Kleo::get_config('blog_layout_default') ) == 'default' ) {
  901. $layout = sq_option( 'site_layout', Kleo::get_config('site_layout_default'));
  902. } else {
  903. $layout = sq_option( 'blog_layout', Kleo::get_config('blog_layout_default'));
  904. }
  905.  
  906. }
  907. }
  908. $layout = apply_filters( 'site_layout', $layout );
  909. kleo_switch_layout( $layout );
  910.  
  911. //page specific overrides
  912. add_filter( 'sq_option', 'kleo_base_options', 10, 2 );
  913.  
  914. if( is_singular()) {
  915. if (get_cfield('page_bg') ) {
  916. Kleo::add_css('body, #content, .page-title-colors, #respond { background-color:' . get_cfield('page_bg') . '!important;}');
  917. }
  918. if (get_cfield('page_bg_image') ) {
  919. Kleo::add_css('body, #content, .page-title-colors, #respond { ' .
  920. 'background-image: url("' . get_cfield('page_bg_image') . '") !important; ' .
  921. 'background-size: cover; background-repeat: no-repeat;' .
  922. '}'
  923. );
  924. }
  925. }
  926.  
  927. }
  928. }
  929.  
  930. add_action( 'wp_head','kleo_prepare_layout' );
  931.  
  932.  
  933. // Logo defaults logic
  934.  
  935. Kleo::set_config( 'logo_default', get_template_directory_uri() . '/assets/images/logo.png' );
  936. Kleo::set_config( 'logo_dark_default', get_template_directory_uri() . '/assets/images/logo-dark.png' );
  937. Kleo::set_config( 'logo_mini_default', get_template_directory_uri() . '/assets/images/logo-mini.png' );
  938.  
  939.  
  940. add_action( 'wp_loaded', 'sq_check_side_bg', 12 );
  941.  
  942. function sq_check_side_bg() {
  943. // if side menu background is dark/white
  944. if ( sq_option( 'sidemenu_header_bg' ) ) {
  945. $sidemenu_color = sq_option( 'sidemenu_header_bg', false, true );
  946. } else {
  947. $sidemenu_color = sq_option( 'sidemenu_style_background_color', '#0c0e38', true );
  948. }
  949.  
  950. if ( kleo_calc_perceived_brightness( $sidemenu_color, 100 ) ) {
  951. $logo_side = 'logo';
  952. } else {
  953. $logo_side = 'logo_dark';
  954. }
  955. Kleo::set_config( 'logo_side', $logo_side );
  956.  
  957.  
  958. // if header background is dark/white
  959. $header_color = sq_option( 'header_style_background_color', '#ffffff' );
  960.  
  961. if ( kleo_calc_perceived_brightness( $header_color, 100 ) ) {
  962. $logo_mobile = 'logo';
  963. } else {
  964. $logo_mobile = 'logo_dark';
  965. }
  966. Kleo::set_config( 'logo_mobile', $logo_mobile );
  967. }
  968.  
  969.  
  970. /* Page specific overrides */
  971. function kleo_base_options( $output, $option ) {
  972. if( $option == 'post_media_status' && is_single() && get_cfield('post_media_status') != '' ) {
  973. if ( get_cfield( 'post_media_status' ) == 'yes' ) {
  974. $output = 1;
  975. } elseif ( get_cfield( 'post_media_status' ) == 'no' ) {
  976. $output = 0;
  977. }
  978. }
  979.  
  980. elseif( $option == 'page_title_enable' && is_singular() && get_cfield('page_title_enable') != '' ) {
  981. if ( get_cfield( 'page_title_enable' ) == 'yes' ) {
  982. $output = true;
  983. } else {
  984. $output = false;
  985. }
  986. }
  987. elseif( $option == 'header_sidemenu' && is_singular() && get_cfield('header_sidemenu') != 'default' ) {
  988. if ( get_cfield( 'header_sidemenu' ) == 'enabled' ) {
  989. $output = true;
  990. } elseif ( get_cfield( 'header_sidemenu' ) == 'disabled' ) {
  991. $output = false;
  992. }
  993. }
  994. return $output;
  995. }
  996.  
  997.  
  998.  
  999. add_action( 'sq_options_after_save', 'kleo_delete_font_transient' );
  1000. add_action( 'customize_save_after', 'kleo_delete_font_transient' );
  1001. function kleo_delete_font_transient() {
  1002. delete_transient( KLEO_DOMAIN . '_google_link' );
  1003. delete_transient('kleo_font_icons');
  1004. }
  1005.  
  1006. if ( ! function_exists( 'remove_wp_open_sans' ) ) {
  1007. /**
  1008. * Remove duplicate Open Sans from WordPress
  1009. */
  1010. function kleo_remove_wp_open_sans() {
  1011. $font_link = get_transient( KLEO_DOMAIN . '_google_link' );
  1012. if ( strpos( $font_link, 'Open+Sans' ) !== false ) {
  1013. wp_deregister_style( 'open-sans' );
  1014. wp_register_style( 'open-sans', false );
  1015. }
  1016. }
  1017. add_action('wp_enqueue_scripts', 'kleo_remove_wp_open_sans');
  1018. }
  1019.  
  1020.  
  1021. function kleo_get_standard_fonts() {
  1022. return array(
  1023. "Arial, Helvetica, sans-serif",
  1024. "'Arial Black', Gadget, sans-serif",
  1025. "'Bookman Old Style', serif",
  1026. "'Comic Sans MS', cursive",
  1027. "Courier, monospace",
  1028. "Garamond, serif",
  1029. "Georgia, serif",
  1030. "Impact, Charcoal, sans-serif",
  1031. "'Lucida Console', Monaco, monospace",
  1032. "'Lucida Sans Unicode', 'Lucida Grande', sans-serif",
  1033. "'MS Sans Serif', Geneva, sans-serif",
  1034. "'MS Serif', 'New York', sans-serif",
  1035. "'Palatino Linotype', 'Book Antiqua', Palatino, serif",
  1036. "Tahoma, Geneva, sans-serif",
  1037. "'Times New Roman', Times, serif",
  1038. "'Trebuchet MS', Helvetica, sans-serif",
  1039. "Verdana, Geneva, sans-serif"
  1040. );
  1041. }
  1042.  
  1043.  
  1044. /* Google fonts Load */
  1045. function sq_load_google_fonts_style() {
  1046. if ( get_google_fonts_link() ) {
  1047. wp_enqueue_style( 'kleo-google-fonts', get_google_fonts_link(), array(), null );
  1048. }
  1049. }
  1050.  
  1051. add_action( 'wp_enqueue_scripts', 'sq_load_google_fonts_style' );
  1052.  
  1053. function get_google_fonts_link() {
  1054.  
  1055. $std_fonts = kleo_get_standard_fonts();
  1056.  
  1057. $fonts = array();
  1058. $sections = array( 'headings', 'text' );
  1059.  
  1060. //kleo_delete_font_transient();
  1061.  
  1062. if ( is_customize_preview() || get_transient( KLEO_DOMAIN . '_google_link' ) === FALSE ) {
  1063.  
  1064. foreach ( $sections as $section ) {
  1065.  
  1066. $font = sq_option ( 'font_' . $section );
  1067.  
  1068. if ( $font == '' ) {
  1069. $font = Kleo::get_config( 'default_font_' . $section );
  1070. }
  1071.  
  1072. $font = str_replace($std_fonts, '', $font);
  1073.  
  1074. if (empty($font) || $font == '') {
  1075. continue;
  1076. }
  1077.  
  1078. $font_style = kleo_get_font_variants( $font );
  1079.  
  1080. $font = str_replace(' ', '+', $font);
  1081. if (!isset($fonts[$font])) {
  1082. $fonts[$font] = array();
  1083. $fonts[$font]['family'] = $font;
  1084. $fonts[$font]['variants'] = $font_style;
  1085. }
  1086.  
  1087. }
  1088.  
  1089. if ( ! empty( $fonts )) {
  1090.  
  1091. $google_link = kleo_make_google_font_link($fonts);
  1092.  
  1093. if( ! is_customize_preview() ) {
  1094. set_transient(KLEO_DOMAIN . '_google_link', $google_link, 12 * 60 * 60);
  1095. }
  1096. }
  1097.  
  1098.  
  1099. } else {
  1100. $google_link = get_transient( KLEO_DOMAIN . '_google_link' );
  1101. }
  1102.  
  1103. return $google_link;
  1104. }
  1105.  
  1106.  
  1107.  
  1108. function kleo_make_google_font_link( $fonts ) {
  1109. $link = "";
  1110. $subsets = array();
  1111.  
  1112. foreach( $fonts as $font ) {
  1113. if ( ! empty( $link )) {
  1114. $link .= "|"; // Append a new font to the string
  1115. }
  1116.  
  1117. $link .= $font['family'];
  1118.  
  1119.  
  1120. if (isset($font['variants'])) {
  1121. $link .= ':' . implode(',', $font['variants']);
  1122. }
  1123.  
  1124.  
  1125. if ( ! empty( $font['subset'] ) ) {
  1126. foreach( $font['subset'] as $subset ) {
  1127. if ( ! in_array( $subset, $subsets ) ) {
  1128. array_push( $subsets, $subset );
  1129. }
  1130. }
  1131.  
  1132. }
  1133. }
  1134. if ( ! empty( $subsets ) ) {
  1135. $link .= "&amp;subset=".implode(',', $subsets);
  1136. }
  1137.  
  1138. return '//fonts.googleapis.com/css?family=' . $link;
  1139.  
  1140. }
  1141.  
  1142. function kleo_get_font_variants( $font_name ) {
  1143.  
  1144. $variants = array();
  1145.  
  1146. $fonts = kleo_get_google_fonts();
  1147.  
  1148. if (! empty($fonts)) {
  1149.  
  1150. foreach ( $fonts->items as $font ) {
  1151. if ( $font_name == $font->family ) {
  1152. $variants = $font->variants;
  1153. }
  1154. }
  1155.  
  1156. foreach ( $variants as $k => $variant ) {
  1157. if ( $variant == 'regular' ) {
  1158. $variants[ $k ] = '400';
  1159. }
  1160. if ( $variant == 'italic' ) {
  1161. $variants[ $k ] = '400italic';
  1162. }
  1163. }
  1164. }
  1165.  
  1166. return (array)$variants;
  1167. }
  1168.  
  1169. function kleo_get_google_fonts() {
  1170.  
  1171. if ( $content = get_transient( 'buddyapp_fonts' ) ) {
  1172. return $content;
  1173. }
  1174. else {
  1175. $selectDirectory = get_template_directory() . '/lib/customizer/assets/';
  1176. $fontFile = $selectDirectory . 'google-web-fonts.txt';
  1177. if ( file_exists( $fontFile ) ) {
  1178. $content = json_decode( sq_fs_get_contents( $fontFile ) );
  1179. } else {
  1180. $googleApi = 'https://www.googleapis.com/webfonts/v1/webfonts?sort=alpha&key=AIzaSyDhrTD5e5gNmX2b4keObH6cHA2DL8rsqMo';
  1181. $font_data = wp_remote_get ( $googleApi, array( 'sslverify' => false ) );
  1182.  
  1183. if ( ! is_wp_error( $font_data ) ) {
  1184. $font_body = wp_remote_retrieve_body($font_data);
  1185. $content = json_decode($font_body);
  1186.  
  1187. sq_fs_put_contents( $fontFile, $font_body );
  1188.  
  1189. } else {
  1190. return $font_data->get_error_message();
  1191. }
  1192.  
  1193. }
  1194.  
  1195. set_transient( 'buddyapp_fonts', $content );
  1196.  
  1197. return $content;
  1198. }
  1199. }
  1200.  
  1201. /***************************************************
  1202. :: Sidebar logic
  1203. ***************************************************/
  1204. if ( ! function_exists( 'kleo_switch_layout' )) {
  1205. /**
  1206. * Change site layout
  1207. *
  1208. * @param bool $layout
  1209. * @param int $priority
  1210. */
  1211. function kleo_switch_layout( $layout = false, $priority = 10 )
  1212. {
  1213. if( $layout == false ) {
  1214. $layout = sq_option( 'site_layout', Kleo::get_config('site_layout_default') );
  1215. }
  1216.  
  1217. switch ( $layout ) {
  1218.  
  1219. case 'left':
  1220. add_action( 'kleo_after_content', 'kleo_sidebar', $priority );
  1221. add_filter( 'kleo_main_section_class', create_function('$classes', ' $classes["tpl"]="tpl-left-sidebar"; return $classes;'), $priority );
  1222. break;
  1223.  
  1224. case 'right':
  1225. add_action( 'kleo_after_content', 'kleo_sidebar', $priority );
  1226. add_filter( 'kleo_main_section_class', create_function('$classes', ' $classes["tpl"]="tpl-right-sidebar"; return $classes;'), $priority );
  1227. break;
  1228.  
  1229. case 'full':
  1230. default :
  1231. remove_action( 'kleo_after_content', 'kleo_sidebar' );
  1232. add_filter( 'kleo_main_section_class', create_function('$classes', ' $classes["tpl"]="tpl-full-width"; return $classes;'), $priority );
  1233.  
  1234. break;
  1235. }
  1236. }
  1237. }
  1238.  
  1239.  
  1240. //get the global sidebar
  1241. if ( ! function_exists( 'kleo_sidebar' ) ):
  1242. function kleo_sidebar()
  1243. {
  1244. get_sidebar();
  1245. }
  1246. endif;
  1247.  
  1248. //return full container class
  1249. function kleo_ret_full_container() {
  1250. return 'container-fluid';
  1251. }
  1252.  
  1253.  
  1254.  
  1255. /***************************************************
  1256. :: Blog full layout logic
  1257. ***************************************************/
  1258.  
  1259. add_action('wp', 'sq_blog_full_actions');
  1260.  
  1261. function sq_blog_full_actions() {
  1262. if ( is_singular( 'post' ) && sq_option( 'blog_style', 'standard', true ) == 'full') {
  1263. add_filter( 'kleo_page_title_class', 'sq_blog_page_title_class' );
  1264. add_filter( 'kleo_page_title_container_class', 'sq_blog_page_title_container_class' );
  1265. add_filter( 'kleo_entry_meta_classes', 'sq_entry_meta_class' );
  1266.  
  1267. add_action('kleo_page_title_section', 'sq_page_title_close_div', 17);
  1268. add_action('kleo_page_title_section', 'kleo_entry_meta', 18);
  1269. add_action('kleo_page_title_section', 'sq_page_title_media', 20);
  1270.  
  1271. }
  1272. }
  1273.  
  1274.  
  1275. function sq_blog_page_title_class( $classes ) {
  1276.  
  1277. $classes[] = 'blog-full';
  1278. $classes[] = 'image-wrapper';
  1279.  
  1280.  
  1281. return $classes;
  1282. }
  1283.  
  1284. function sq_blog_page_title_container_class( $classes ) {
  1285.  
  1286. $classes .= ' top-on-scroll fade-on-scroll';
  1287.  
  1288. return $classes;
  1289. }
  1290.  
  1291. function sq_entry_meta_class( $classes ) {
  1292.  
  1293. $classes .= ' fade-on-scroll-second bottom-on-scroll';
  1294.  
  1295. return $classes;
  1296. }
  1297.  
  1298.  
  1299.  
  1300. function sq_page_title_close_div() {
  1301. echo '</div>';
  1302. }
  1303.  
  1304. function sq_page_title_media() {
  1305. $kleo_post_format = get_post_format();
  1306. ?>
  1307.  
  1308. <div class="entry-image">
  1309. <?php
  1310. switch ( $kleo_post_format ) {
  1311. case 'image':
  1312. default:
  1313. if ( kleo_get_post_thumbnail_url() != '' ) {
  1314.  
  1315. $img_url = kleo_get_post_thumbnail_url();
  1316. $image = aq_resize( $img_url, 1200, null, true, true, true );
  1317. if ( ! $image ) {
  1318. $image = $img_url;
  1319. }
  1320. echo '<img class="image_fade image fade-on-scroll-half" src="' . $image . '" alt="' . get_the_title() . '">';
  1321.  
  1322. }
  1323.  
  1324. break;
  1325. }
  1326. ?>
  1327.  
  1328. <?php
  1329. }
  1330.  
  1331.  
  1332.  
  1333. /***************************************************
  1334. :: Hide Header functionality
  1335. ***************************************************/
  1336.  
  1337. add_action( 'kleo_after_body', 'sq_add_side_trigger', 1);
  1338.  
  1339. function sq_add_side_trigger() {
  1340. if( sq_option( 'header_status', true, true ) == false ) {
  1341. ?>
  1342. <a href="#" class="sidemenu-trigger hamburger hamburger-elastic">
  1343. <span class="hamburger-box">
  1344. <span class="hamburger-inner"></span>
  1345. </span>
  1346. </a>
  1347. <?php
  1348. }
  1349. }
  1350.  
  1351.  
  1352.  
  1353. /***************************************************
  1354. :: Header section functions
  1355. ***************************************************/
  1356.  
  1357. /**
  1358. * Display the classes for the header element.
  1359. *
  1360. * @since 1.0
  1361. *
  1362. * @param string|array $class One or more classes to add to the class list.
  1363. */
  1364. function kleo_header_class( $class = '' ) {
  1365. // Separates classes with a single space, collates classes for body element
  1366. echo 'class="' . join( ' ', kleo_get_header_class( $class ) ) . '"';
  1367. }
  1368.  
  1369. /**
  1370. * Retrieve the classes for the header element as an array.
  1371. *
  1372. * @since 1.0
  1373. *
  1374. * @param string|array $class One or more classes to add to the class list.
  1375. * @return array Array of classes.
  1376. */
  1377. function kleo_get_header_class( $class = '' ) {
  1378.  
  1379. $classes = array( 'header-colors' );
  1380.  
  1381. if ( ! empty( $class ) ) {
  1382. if ( !is_array( $class ) ) {
  1383. $class = preg_split('#\s+#', $class);
  1384. }
  1385. $classes = array_merge( $classes, $class );
  1386. } else {
  1387. // Ensure that we always coerce class to being an array.
  1388. $class = array();
  1389. }
  1390.  
  1391. $classes = apply_filters( 'kleo_header_class', $classes, $class );
  1392.  
  1393. return array_unique( $classes );
  1394. }
  1395.  
  1396.  
  1397. /***************************************************
  1398. :: Menu section functions
  1399. ***************************************************/
  1400.  
  1401. /**
  1402. * Display the classes for the menu element.
  1403. *
  1404. * @since 1.0
  1405. *
  1406. * @param string|array $class One or more classes to add to the class list.
  1407. */
  1408. function kleo_menu_class( $class = '' ) {
  1409. // Separates classes with a single space, collates classes for body element
  1410. echo 'class="' . join( ' ', kleo_get_menu_class( $class ) ) . '"';
  1411. }
  1412.  
  1413. /**
  1414. * Retrieve the classes for the menu element as an array.
  1415. *
  1416. * @since 1.0
  1417. *
  1418. * @param string|array $class One or more classes to add to the class list.
  1419. * @return array Array of classes.
  1420. */
  1421. function kleo_get_menu_class( $class = '' ) {
  1422.  
  1423. $classes = array();
  1424.  
  1425. if ( ! empty( $class ) ) {
  1426. if ( !is_array( $class ) ) {
  1427. $class = preg_split('#\s+#', $class);
  1428. }
  1429. $classes = array_merge( $classes, $class );
  1430. } else {
  1431. // Ensure that we always coerce class to being an array.
  1432. $class = array();
  1433. }
  1434.  
  1435. $classes = apply_filters( 'kleo_menu_class', $classes, $class );
  1436.  
  1437. return array_unique( $classes );
  1438. }
  1439.  
  1440.  
  1441. function kleo_header_attribute( $attribute = '' ) {
  1442. $attributes = array();
  1443.  
  1444. if ( $attribute != '' ) {
  1445. $attributes[] = $attribute;
  1446. }
  1447.  
  1448. $attributes = apply_filters( 'kleo_header_attribute', $attributes, $attribute );
  1449.  
  1450. if ( !empty( $attributes ) ) {
  1451. echo join( ' ', (array) $attributes );
  1452. } else {
  1453. echo '';
  1454. }
  1455. }
  1456.  
  1457.  
  1458.  
  1459. /***************************************************
  1460. :: Main section functions
  1461. ***************************************************/
  1462.  
  1463.  
  1464. /**
  1465. * Display the classes for the main section.
  1466. *
  1467. * @since 1.0
  1468. *
  1469. * @param string|array $class One or more classes to add to the class list.
  1470. */
  1471. function kleo_main_section_class( $class = '' ) {
  1472. // Separates classes with a single space, collates classes for body element
  1473. echo 'class="' . join( ' ', kleo_get_main_section_class( $class ) ) . '"';
  1474. }
  1475.  
  1476. /**
  1477. * Retrieve the classes for the menu element as an array.
  1478. *
  1479. * @since 1.0
  1480. *
  1481. * @param string|array $class One or more classes to add to the class list.
  1482. * @return array Array of classes.
  1483. */
  1484. function kleo_get_main_section_class( $class = '' ) {
  1485.  
  1486. $classes = array();
  1487.  
  1488. if ( ! empty( $class ) ) {
  1489. if ( !is_array( $class ) ) {
  1490. $class = preg_split('#\s+#', $class);
  1491. }
  1492. $classes = array_merge( $classes, $class );
  1493. } else {
  1494. // Ensure that we always coerce class to being an array.
  1495. $class = array();
  1496. }
  1497.  
  1498. $classes = apply_filters( 'kleo_main_section_class', $classes, $class );
  1499.  
  1500. return array_unique( $classes );
  1501. }
  1502.  
  1503.  
  1504.  
  1505. /***************************************************
  1506. :: SIDEBAR section functions
  1507. ***************************************************/
  1508.  
  1509.  
  1510. /**
  1511. * Display the classes for the main section.
  1512. *
  1513. * @since 1.0
  1514. *
  1515. * @param string|array $class One or more classes to add to the class list.
  1516. */
  1517. function kleo_sidebar_class( $class = '' ) {
  1518. // Separates classes with a single space, collates classes for body element
  1519. echo 'class="' . join( ' ', kleo_get_sidebar_class( $class ) ) . '"';
  1520. }
  1521.  
  1522. /**
  1523. * Retrieve the classes for the menu element as an array.
  1524. *
  1525. * @since 1.0
  1526. *
  1527. * @param string|array $class One or more classes to add to the class list.
  1528. * @return array Array of classes.
  1529. */
  1530. function kleo_get_sidebar_class( $class = '' ) {
  1531.  
  1532. $classes = array();
  1533.  
  1534. if ( ! empty( $class ) ) {
  1535. if ( !is_array( $class ) ) {
  1536. $class = preg_split('#\s+#', $class);
  1537. }
  1538. $classes = array_merge( $classes, $class );
  1539. } else {
  1540. // Ensure that we always coerce class to being an array.
  1541. $class = array();
  1542. }
  1543.  
  1544. $classes = apply_filters( 'kleo_sidebar_class', $classes, $class );
  1545.  
  1546. return array_unique( $classes );
  1547. }
Advertisement
Add Comment
Please, Sign In to add comment