Advertisement
Guest User

Untitled

a guest
Apr 17th, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.29 KB | None | 0 0
  1. <?php
  2. /**
  3. * Functions which enhance the theme into WordPress
  4. *
  5. * @package arilewp
  6. */
  7.  
  8. /**
  9. * Theme Custom Logo
  10. */
  11. function arilewp_header_logo() {
  12.  
  13. $arilewp_main_header_style = get_theme_mod('arilewp_main_header_style', 'standard');
  14. $arilewp_sticky_bar_logo = get_theme_mod('arilewp_sticky_bar_logo');
  15. $arilewp_transparent_header_logo = get_theme_mod('arilewp_transparent_header_logo');
  16.  
  17. if($arilewp_transparent_header_logo != null && $arilewp_main_header_style == 'transparent' && is_page_template('page-templates/frontpage.php') ){ ?>
  18.  
  19. <a class="navbar-brand" href="<?php echo home_url( '/' ); ?>" ><img src="<?php echo $arilewp_transparent_header_logo; ?>" class="custom-logo" alt="<?php bloginfo("name"); ?>"></a>
  20.  
  21. <?php } elseif($arilewp_transparent_header_logo != null && $arilewp_main_header_style == 'overlap_classic'){ ?>
  22.  
  23. <a class="navbar-brand" href="<?php echo home_url( '/' ); ?>" ><img src="<?php echo $arilewp_transparent_header_logo; ?>" class="custom-logo" alt="<?php bloginfo("name"); ?>"></a>
  24.  
  25. <?php }
  26.  
  27. else {
  28. the_custom_logo();
  29. }
  30. ?>
  31.  
  32. <?php if($arilewp_sticky_bar_logo != null) : ?>
  33. <a class="sticky-navbar-brand" href="<?php echo home_url( '/' ); ?>" ><img src="<?php echo $arilewp_sticky_bar_logo; ?>" class="custom-logo" alt="<?php bloginfo("name"); ?>"></a>
  34. <?php endif; ?>
  35.  
  36. <?php if ( display_header_text() ) : ?>
  37. <div class="site-branding-text">
  38. <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
  39. <?php
  40. $description = get_bloginfo( 'description', 'display' );
  41. if ( $description || is_customize_preview() ) : ?>
  42. <p class="site-description"><?php echo $description; ?></p>
  43. <?php endif; ?>
  44. </div>
  45. <?php endif;
  46. }
  47.  
  48. /**
  49. * Theme Logo Class
  50. */
  51. function arilewp_header_logo_class($html)
  52. {
  53. $html = str_replace('custom-logo-link', 'navbar-brand', $html);
  54. return $html;
  55. }
  56. add_filter('get_custom_logo','arilewp_header_logo_class');
  57.  
  58. /**
  59. * Theme Pages
  60. */
  61. function fresh_site_activate()
  62. {
  63. $fresh_site_activate = get_option( 'fresh_site_activate' );
  64. if ( (bool) $fresh_site_activate === false ) {
  65. $pages = array( esc_html__( 'Home', 'arilewp' ), esc_html__( 'Blog', 'arilewp' ) );
  66. foreach ($pages as $page){
  67. $post_data = array( 'post_author' => 1, 'post_name' => $page, 'post_status' => 'publish' , 'post_title' => $page, 'post_type' => 'page', );
  68. if($page== 'Home'):
  69. $page_option = 'page_on_front';
  70. $template = 'page-templates/frontpage.php';
  71. else:
  72. $page_option = 'page_for_posts';
  73. $template = 'page.php';
  74. endif;
  75. $post_data = wp_insert_post( $post_data, false );
  76. if ( $post_data ){
  77. update_post_meta( $post_data, '_wp_page_template', $template );
  78. $page = get_page_by_title($page);
  79. update_option( 'show_on_front', 'page' );
  80. update_option( $page_option, $page->ID );
  81. }
  82. }
  83. update_option( 'fresh_site_activate', true );
  84. }
  85. }
  86. fresh_site_activate();
  87.  
  88. /**
  89. * Theme Comment Function
  90. */
  91. if ( ! function_exists( 'arilewp_comment' ) ) :
  92. function arilewp_comment( $comment, $args, $depth )
  93. {
  94. $GLOBALS['comment'] = $comment;
  95. //get theme data
  96. global $comment_data;
  97.  
  98. //translations
  99. $leave_reply = $comment_data['translation_reply_to_coment'] ? $comment_data['translation_reply_to_coment'] :
  100. __('Reply','arilewp');?>
  101.  
  102. <div <?php comment_class('media comment-box'); ?> id="comment-<?php comment_ID(); ?>">
  103. <a class="pull-left-comment">
  104. <?php echo get_avatar($comment); ?>
  105. </a>
  106. <div class="media-body">
  107. <div class="comment-detail">
  108. <h5 class="comment-detail-title"><?php printf(('%s'), get_comment_author_link()) ?>
  109. <time class="comment-date">
  110. <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) );?>">
  111. <?php comment_date('F j, Y');?>&nbsp;<?php esc_html_e('at','arilewp');?>&nbsp;<?php comment_time('g:i a'); ?>
  112. </a>
  113. </time></h5>
  114. <?php comment_text() ;?>
  115. <div class="reply">
  116. <?php comment_reply_link(array_merge( $args, array('reply_text' => $leave_reply,'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  117. </div>
  118. <?php if ( $comment->comment_approved == '0' ) : ?>
  119. <em class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'arilewp' ); ?></em>
  120. <br/>
  121. <?php endif; ?>
  122. </div>
  123. </div>
  124. </div>
  125. <?php
  126. }
  127. endif;
  128. add_filter('get_avatar','arilewp_gravatar_class');
  129. function arilewp_gravatar_class($class) {
  130. $class = str_replace("class='avatar", "class='img-fluid comment-img", $class);
  131. return $class;
  132. }
  133.  
  134. function arilewp_read_more_button_class($read_class)
  135. { global $post;
  136. return '<p><a href="' . esc_url(get_permalink()) . "#more-{$post->ID}\" class=\"more-link\">" .esc_html__('Read More','arilewp')."</a></p>";
  137. }
  138. add_filter( 'the_content_more_link', 'arilewp_read_more_button_class' );
  139.  
  140. function arilewp_post_thumbnail() {
  141. if(has_post_thumbnail()){
  142. echo '<figure class="post-thumbnail"><a href="'.esc_url(get_the_permalink()).'">';
  143. the_post_thumbnail( '', array( 'class'=>'img-fluid' ) );
  144. echo '</a></figure>';
  145. }
  146. }
  147.  
  148. /**
  149. * Theme Page Header Title
  150. */
  151. function arilewp_theme_page_header_title(){
  152. $arilewp_page_header_layout = get_theme_mod('arilewp_page_header_layout', 'arilewp_page_header_layout1');
  153. if($arilewp_page_header_layout == 'arilewp_page_header_layout1'):
  154. $page_title_class = 'text-center';
  155. else: $page_title_class = '';
  156. endif;
  157. if( is_archive() )
  158. {
  159. echo '<div class="page-header-title '.$page_title_class.'"><h1 class="text-white">';
  160. if ( is_day() ) :
  161. printf( __( '%1$s %2$s', 'arilewp' ), __('','arilewp'), get_the_date() );
  162. elseif ( is_month() ) :
  163. printf( __( '%1$s %2$s', 'arilewp' ), __('','arilewp'), get_the_date( 'F Y' ) );
  164. elseif ( is_year() ) :
  165. printf( __( '%1$s %2$s', 'arilewp' ), __('','arilewp'), get_the_date( 'Y' ) );
  166. elseif( is_author() ):
  167. printf( __( '%1$s %2$s', 'arilewp' ), __('','arilewp'), get_the_author() );
  168. elseif( is_category() ):
  169. printf( __( '%1$s %2$s', 'arilewp' ), __('','arilewp'), single_cat_title( '', false ) );
  170. elseif( is_tag() ):
  171. printf( __( '%1$s %2$s', 'arilewp' ), __('','arilewp'), single_tag_title( '', false ) );
  172. elseif( class_exists( 'WooCommerce' ) && is_shop() ):
  173. printf( __( '%1$s %2$s', 'arilewp' ), __('','arilewp'), single_tag_title( '', false ));
  174. elseif( is_archive() ):
  175. the_archive_title( '<h1 class="text-white">', '</h1>' );
  176. endif;
  177. echo '</h1></div>';
  178. }
  179. elseif( is_404() )
  180. {
  181. echo '<div class="page-header-title '.$page_title_class.'"><h1 class="text-white">';
  182. printf( __( '%1$s ', 'arilewp' ) , __('404','arilewp') );
  183. echo '</h1></div>';
  184. }
  185. elseif( is_search() )
  186. {
  187. echo '<div class="page-header-title '.$page_title_class.'"><h1 class="text-white">';
  188. printf( __( '%1$s %2$s', 'arilewp' ), __('Search results for','arilewp'), get_search_query() );
  189. echo '</h1></div>';
  190. }
  191. else
  192. {
  193. echo '<div class="page-header-title '.$page_title_class.'"><h1 class="text-white">'.get_the_title().'</h1></div>';
  194. }
  195. }
  196.  
  197. function arilewp_bootstrap_menu_notitle( $menu ){
  198. return $menu = preg_replace('/ title=\"(.*?)\"/', '', $menu );
  199. }
  200. add_filter( 'wp_nav_menu', 'arilewp_bootstrap_menu_notitle' );
  201.  
  202. /**
  203. * Theme Breadcrumbs Url
  204. */
  205. function arilewp_page_url() {
  206. $page_url = 'http';
  207. if ( key_exists("HTTPS", $_SERVER) && ( $_SERVER["HTTPS"] == "on" ) ){
  208. $page_url .= "s";
  209. }
  210. $page_url .= "://";
  211. if ($_SERVER["SERVER_PORT"] != "80") {
  212. $page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  213. } else {
  214. $page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  215. }
  216. return $page_url;
  217. }
  218.  
  219. /**
  220. * Theme Breadcrumbs
  221. */
  222. if( !function_exists('arilewp_page_header_breadcrumbs') ):
  223. function arilewp_page_header_breadcrumbs() {
  224. global $post;
  225. $homeLink = home_url();
  226. $arilewp_page_header_layout = get_theme_mod('arilewp_page_header_layout', 'arilewp_page_header_layout1');
  227. if($arilewp_page_header_layout == 'arilewp_page_header_layout1'):
  228. $breadcrumb_class = 'text-center';
  229. else: $breadcrumb_class = 'text-right';
  230. endif;
  231.  
  232. echo '<ul class="page-breadcrumb '.$breadcrumb_class.'">';
  233. if (is_home() || is_front_page()) :
  234. echo '<li><a href="'.$homeLink.'">'.__('Home','arilewp').'</a></li>';
  235. echo '<li class="active">'; echo single_post_title(); echo '</li>';
  236. else:
  237. echo '<li><a href="'.$homeLink.'">'.__('Home','arilewp').'</a></li>';
  238. if ( is_category() ) {
  239. echo '<li class="active"><a href="'. arilewp_page_url() .'">' . __('Archive by category','arilewp').' "' . single_cat_title('', false) . '"</a></li>';
  240. } elseif ( is_day() ) {
  241. echo '<li class="active"><a href="'. get_year_link(get_the_time('Y')) . '">'. get_the_time('Y') .'</a>';
  242. echo '<li class="active"><a href="'. get_month_link(get_the_time('Y'),get_the_time('m')) .'">'. get_the_time('F') .'</a>';
  243. echo '<li class="active"><a href="'. arilewp_page_url() .'">'. get_the_time('d') .'</a></li>';
  244. } elseif ( is_month() ) {
  245. echo '<li class="active"><a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>';
  246. echo '<li class="active"><a href="'. arilewp_page_url() .'">'. get_the_time('F') .'</a></li>';
  247. } elseif ( is_year() ) {
  248. echo '<li class="active"><a href="'. arilewp_page_url() .'">'. get_the_time('Y') .'</a></li>';
  249. } elseif ( is_single() && !is_attachment() && is_page('single-product') ) {
  250. if ( get_post_type() != 'post' ) {
  251. $cat = get_the_category();
  252. $cat = $cat[0];
  253. echo '<li>';
  254. echo get_category_parents($cat, TRUE, '');
  255. echo '</li>';
  256. echo '<li class="active"><a href="' . arilewp_page_url() . '">'. wp_title( '',false ) .'</a></li>';
  257. } }
  258. elseif ( is_page() && $post->post_parent ) {
  259. $parent_id = $post->post_parent;
  260. $breadcrumbs = array();
  261. while ($parent_id) {
  262. $page = get_page($parent_id);
  263. $breadcrumbs[] = '<li class="active"><a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
  264. $parent_id = $page->post_parent;
  265. }
  266. $breadcrumbs = array_reverse($breadcrumbs);
  267. foreach ($breadcrumbs as $crumb) echo $crumb;
  268. echo '<li class="active"><a href="' . arilewp_page_url() . '">'. get_the_title() .'</a></li>';
  269. }
  270. elseif( is_search() )
  271. {
  272. echo '<li class="active"><a href="' . arilewp_page_url() . '">'. get_search_query() .'</a></li>';
  273. }
  274. elseif( is_404() )
  275. {
  276. echo '<li class="active"><a href="' . arilewp_page_url() . '">'.__('Error 404','arilewp').'</a></li>';
  277. }
  278. else {
  279. echo '<li class="active"><a href="' . arilewp_page_url() . '">'. get_the_title() .'</a></li>';
  280. }
  281. endif;
  282. echo '</ul>';
  283. }
  284. endif;
  285.  
  286. /*
  287. * Import customizer options from Lite version
  288. */
  289. add_action( 'after_switch_theme', 'arilewp_merge_lite_options' );
  290. /**
  291. * Import lite options.
  292. */
  293. function arilewp_merge_lite_options() {
  294.  
  295. $arilewp_mods = get_option( 'theme_mods_arilewp' );
  296.  
  297. if ( ! empty( $arilewp_mods ) ) {
  298.  
  299. foreach ( $arilewp_mods as $arilewp_mod_k => $arilewp_mod_v ) {
  300. set_theme_mod( $arilewp_mod_k, $arilewp_mod_v );
  301. }
  302. }
  303. }
  304.  
  305. add_action( 'after_switch_theme', 'arilewp_import_theme_mods_from_child_theme_to_pro_theme' );
  306.  
  307. /**
  308. * Import theme options from child theme to ArileWP Pro theme
  309. */
  310. function arilewp_import_theme_mods_from_child_theme_to_pro_theme() {
  311.  
  312. // Get the name of the previously active theme.
  313. $previous_theme = strtolower( get_option( 'theme_switched' ) );
  314.  
  315. if ( ! in_array(
  316. $previous_theme, array(
  317. 'business-street',
  318. 'strangerwp',
  319. 'newyork-city',
  320. 'arilewp-child-theme',
  321. )
  322. ) ) {
  323. return;
  324. }
  325.  
  326. // Get the theme mods from the previous theme.
  327. $previous_theme_content = get_option( 'theme_mods_' . $previous_theme );
  328.  
  329. if ( ! empty( $previous_theme_content ) ) {
  330. foreach ( $previous_theme_content as $previous_theme_mod_k => $previous_theme_mod_v ) {
  331. set_theme_mod( $previous_theme_mod_k, $previous_theme_mod_v );
  332. }
  333. }
  334. }
  335.  
  336. /**
  337. * Import lite project options.
  338. */
  339. $merge_project_lite_options = get_option( 'merge_project_lite_options' , 'lite');
  340. $arilewp_project_content = get_theme_mod( 'arilewp_project_content');
  341. if ( ! empty( $arilewp_project_content ) ) {
  342. if ( $merge_project_lite_options === 'lite' ) {
  343. $allowed_html = array('br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(),'i' => array());
  344. $arilewp_project_content = json_decode($arilewp_project_content);
  345. foreach ( $arilewp_project_content as $project_item ) {
  346. $image_url = ! empty( $project_item->image_url ) ? $project_item->image_url : '';
  347. $title = ! empty( $project_item->title ) ? $project_item->title : '';
  348. $text = ! empty( $project_item->text ) ? $project_item->text : '';
  349.  
  350. if(!empty($title)){
  351. $post_id = wp_insert_post(
  352. array (
  353. 'post_type' => 'arilewp_portfolio',
  354. 'post_title' => $title,
  355. 'post_status' => 'publish',
  356. ));
  357. $filename = $image_url;
  358. $filetype = wp_check_filetype( basename( $filename ), null );
  359. $wp_upload_dir = wp_upload_dir();
  360. $attachment = array(
  361. 'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),
  362. 'post_mime_type' => $filetype['type'],
  363. 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
  364. 'post_content' => '',
  365. 'post_status' => 'inherit'
  366. );
  367. $attach_id = wp_insert_attachment( $attachment, $filename, $post_id );
  368. set_post_thumbnail( $post_id, $attach_id );
  369. update_post_meta($post_id, 'custom_portfolio_description', sanitize_text_field($text));
  370. $table_name = $wpdb->prefix . "term_relationships";
  371. $wpdb->insert($table_name, array('object_id' => $post_id, 'term_taxonomy_id' => 2 ,'term_order' => 0) );
  372. }
  373. }
  374. update_option( 'merge_project_lite_options', 'update' );
  375. }
  376.  
  377. }
  378.  
  379.  
  380. /**
  381. * Blog Masonry
  382. */
  383. function arilewp_custom_script()
  384. {
  385. wp_reset_query();
  386. $col =6;
  387. if(is_page_template('page-templates/blog-masonry-2-col.php'))
  388. { $col =6; }
  389. elseif(is_page_template('page-templates/blog-masonry-3-col.php'))
  390. { $col =4; }
  391. elseif(is_page_template('page-templates/blog-masonry-4-col.php'))
  392. { $col =3; }
  393. ?>
  394. <script>
  395. jQuery(document).ready(function ( jQuery ) {
  396. jQuery("#blog-masonry").mpmansory(
  397. {
  398. childrenClass: 'item', // default is a div
  399. columnClasses: 'padding', //add classes to items
  400. breakpoints:{
  401. xl: <?php echo $col; ?>, //Change masonry column here like 2, 3, 4 column
  402. lg: 4,
  403. md: 6,
  404. sm: 12,
  405. xs: 12
  406. },
  407. distributeBy: { order: false, height: false, attr: 'data-order', attrOrder: 'asc' }, //default distribute by order, options => order: true/false, height: true/false, attr => 'data-order', attrOrder=> 'asc'/'desc'
  408. onload: function (items) {
  409. //make somthing with items
  410. }
  411. }
  412. );
  413. });
  414. </script>
  415. <?php
  416. }
  417. add_action('wp_footer','arilewp_custom_script');
  418.  
  419.  
  420. function arilewp_background_image()
  421. {
  422. $theme_boxed_image = get_theme_mod('arilewp_theme_background_image','bg-patternm1');
  423. if($theme_boxed_image!='')
  424. {
  425. if($theme_boxed_image == 'bg-patternm1' || $theme_boxed_image == 'bg-patternm2' || $theme_boxed_image == 'bg-patternm3' || $theme_boxed_image == 'bg-patternm4'){ $image_format = 'png';}
  426. else { $image_format = 'jpg'; }
  427. echo '<style>body.theme-boxed{ background:url("'.ARILEWP_PARENT_INC_ICON_URI.'/'.$theme_boxed_image.'.'.$image_format.'") repeat fixed;}</style>';
  428. }
  429. }
  430. add_action('wp_head','arilewp_background_image',10,0);
  431.  
  432. /**
  433. * Add object term default
  434. */
  435. function arilewp_default_object_terms( $post_id, $post ) {
  436. if ( 'publish' === $post->post_status && $post->post_type === 'arilewp_portfolio' ) {
  437. $defaults = array( 'portfolio_categories' => array( 'Show All' ) );
  438. $taxonomies = get_object_taxonomies( $post->post_type );
  439. foreach ( (array) $taxonomies as $taxonomy ) {
  440. $terms = wp_get_post_terms( $post_id, $taxonomy );
  441. if ( empty( $terms ) && array_key_exists( $taxonomy, $defaults ) ) {
  442. wp_set_object_terms( $post_id, $defaults[$taxonomy], $taxonomy );
  443. }
  444. }
  445. }
  446. }
  447. add_action( 'save_post', 'arilewp_default_object_terms', 0, 2 );
  448.  
  449. /**
  450. * Custom Theme Script
  451. */
  452. function arilewp_custom_owl_theme_scripts() {
  453. $arilewp_main_slider_aniamte_type = get_theme_mod('arilewp_main_slider_aniamte_type', 'slide');
  454. if($arilewp_main_slider_aniamte_type == 'fade'):
  455. $arilewp_main_slider_aniamte_in = 'fadeIn'; $arilewp_main_slider_aniamte_out = 'fadeOut';
  456. else:
  457. $arilewp_main_slider_aniamte_in = ''; $arilewp_main_slider_aniamte_out = '';
  458. endif;
  459. $arilewp_main_slider_scroll_speed = get_theme_mod('arilewp_main_slider_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  460. $arilewp_main_slider_smart_speed = get_theme_mod('arilewp_main_slider_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  461. $arilewp_main_slider_mouse_drag_disabled = get_theme_mod('arilewp_main_slider_mouse_drag_disabled', true);
  462.  
  463. $arilewp_project_scroll_speed = get_theme_mod('arilewp_project_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  464. $arilewp_project_smart_speed = get_theme_mod('arilewp_project_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  465. $arilewp_project_mouse_drag_disabled = get_theme_mod('arilewp_project_mouse_drag_disabled', true);
  466. $arilewp_project_column_layout = get_theme_mod('arilewp_project_column_layout', '4');
  467.  
  468. $arilewp_testimonial_scroll_speed = get_theme_mod('arilewp_testimonial_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  469. $arilewp_testimonial_smart_speed = get_theme_mod('arilewp_testimonial_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  470. $arilewp_testimonial_mouse_drag_disabled = get_theme_mod('arilewp_testimonial_mouse_drag_disabled', true);
  471. $arilewp_testimonial_column_layout = get_theme_mod('arilewp_testimonial_column_layout', '3');
  472.  
  473. $arilewp_wooshop_scroll_speed = get_theme_mod('arilewp_wooshop_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  474. $arilewp_wooshop_smart_speed = get_theme_mod('arilewp_wooshop_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  475. $arilewp_wooshop_mouse_drag_disabled = get_theme_mod('arilewp_wooshop_mouse_drag_disabled', true);
  476. $arilewp_wooshop_column_layout = get_theme_mod('arilewp_wooshop_column_layout', '4');
  477.  
  478. $arilewp_team_scroll_speed = get_theme_mod('arilewp_team_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  479. $arilewp_team_smart_speed = get_theme_mod('arilewp_team_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  480. $arilewp_team_mouse_drag_disabled = get_theme_mod('arilewp_team_mouse_drag_disabled', true);
  481. $arilewp_team_column_layout = get_theme_mod('arilewp_team_column_layout', '3');
  482.  
  483. $arilewp_client_scroll_speed = get_theme_mod('arilewp_client_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  484. $arilewp_client_smart_speed = get_theme_mod('arilewp_client_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  485. $arilewp_client_mouse_drag_disabled = get_theme_mod('arilewp_client_mouse_drag_disabled', true);
  486. $arilewp_client1_column_layout = get_theme_mod('arilewp_client1_column_layout', '5');
  487.  
  488. $custom_data = array(
  489. 'arilewp_main_slider_aniamte_in' => $arilewp_main_slider_aniamte_in,
  490. 'arilewp_main_slider_aniamte_out' => $arilewp_main_slider_aniamte_out,
  491. 'arilewp_main_slider_scroll_speed' => $arilewp_main_slider_scroll_speed['slider'],
  492. 'arilewp_main_slider_smart_speed' => $arilewp_main_slider_smart_speed['slider'],
  493. 'arilewp_main_slider_mouse_drag_disabled' => $arilewp_main_slider_mouse_drag_disabled,
  494. 'arilewp_project_scroll_speed' => $arilewp_project_scroll_speed['slider'],
  495. 'arilewp_project_smart_speed' => $arilewp_project_smart_speed['slider'],
  496. 'arilewp_project_mouse_drag_disabled' => $arilewp_project_mouse_drag_disabled,
  497. 'arilewp_project_column_layout' => $arilewp_project_column_layout,
  498. 'arilewp_testimonial_scroll_speed' => $arilewp_testimonial_scroll_speed['slider'],
  499. 'arilewp_testimonial_smart_speed' => $arilewp_testimonial_smart_speed['slider'],
  500. 'arilewp_testimonial_mouse_drag_disabled' => $arilewp_testimonial_mouse_drag_disabled,
  501. 'arilewp_testimonial_column_layout' => $arilewp_testimonial_column_layout,
  502. 'arilewp_wooshop_scroll_speed' => $arilewp_wooshop_scroll_speed['slider'],
  503. 'arilewp_wooshop_smart_speed' => $arilewp_wooshop_smart_speed['slider'],
  504. 'arilewp_wooshop_mouse_drag_disabled' => $arilewp_wooshop_mouse_drag_disabled,
  505. 'arilewp_wooshop_column_layout' => $arilewp_wooshop_column_layout,
  506. 'arilewp_team_scroll_speed' => $arilewp_team_scroll_speed['slider'],
  507. 'arilewp_team_smart_speed' => $arilewp_team_smart_speed['slider'],
  508. 'arilewp_team_mouse_drag_disabled' => $arilewp_team_mouse_drag_disabled,
  509. 'arilewp_team_column_layout' => $arilewp_team_column_layout,
  510. 'arilewp_client_scroll_speed' => $arilewp_client_scroll_speed['slider'],
  511. 'arilewp_client_smart_speed' => $arilewp_client_smart_speed['slider'],
  512. 'arilewp_client_mouse_drag_disabled' => $arilewp_client_mouse_drag_disabled,
  513. 'arilewp_client1_column_layout' => $arilewp_client1_column_layout,
  514. );
  515.  
  516. wp_register_script('arilewp-custom',get_template_directory_uri().'/assets/js/custom.js',array('jquery'));
  517. wp_localize_script('arilewp-custom','custom_data',$custom_data);
  518. wp_enqueue_script('arilewp-custom');
  519. }
  520. add_action( 'wp_enqueue_scripts', 'arilewp_custom_owl_theme_scripts' );
  521.  
  522. /**
  523. * Theme Pagination Class.
  524. */
  525. class Class_ArileWP_Theme_Pagination
  526. {
  527. function arilewp_pagination()
  528. {
  529. global $post;
  530. global $wp_query, $wp_rewrite,$loop;
  531. if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
  532. elseif ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); } else { $paged = 1; }
  533. if($wp_query->max_num_pages==0){ $wp_query = $loop; }
  534. ?>
  535. <div class="pagination">
  536. <?php if( $paged != 1 ) : ?>
  537. <a href="<?php echo get_pagenum_link(($paged-1 > 0 ? $paged-1 : 1)); ?>"><i class="fa fa-angle-double-left"></i></a><?php endif; ?><?php for($i=1;$i<=($wp_query->max_num_pages>1 ? $wp_query->max_num_pages : 0 );$i++){ ?> <a class="<?php echo ($i == $paged ? 'active ' : ''); ?>" href="<?php echo get_pagenum_link($i); ?>"><?php echo $i; ?></a> <?php } ?>
  538. <?php if($wp_query->max_num_pages!= $paged): ?>
  539. <a href="<?php echo get_pagenum_link(($paged+1 <= $wp_query->max_num_pages ? $paged+1 : $wp_query->max_num_pages )); ?>"><i class="fa fa-angle-double-right"></i></a>
  540. <?php endif; ?>
  541. </div>
  542. <?php
  543. }
  544. }
  545.  
  546. /**
  547. * Add WPML and Polylang compatibility.
  548. */
  549.  
  550. function arilewp_translate_single_string( $original_value, $domain ) {
  551. if ( is_customize_preview() ) {
  552. $wpml_translation = $original_value;
  553. } else {
  554. $wpml_translation = apply_filters( 'wpml_translate_single_string', $original_value, $domain, $original_value );
  555. if ( $wpml_translation === $original_value && function_exists( 'pll__' ) ) {
  556. return pll__( $original_value );
  557. }
  558. }
  559. return $wpml_translation;
  560. }
  561. add_filter( 'arilewp_translate_single_string', 'arilewp_translate_single_string', 10, 2 );
  562.  
  563. /**
  564. * register pll string.
  565. */
  566. function arilewp_pll_string_register( $theme_mod ) {
  567. if ( ! function_exists( 'pll_register_string' ) ) { return; }
  568. $repeater_content = get_theme_mod( $theme_mod );
  569. $repeater_content = json_decode( $repeater_content );
  570. if ( ! empty( $repeater_content ) ) {
  571. foreach ( $repeater_content as $repeater_item ) {
  572. foreach ( $repeater_item as $field_name => $field_value ) {
  573. if ( $field_value !== 'undefined' ) {
  574. if ( $field_name !== 'id' ) {
  575. $f_n = ucfirst( $field_name );
  576. pll_register_string( $f_n, $field_value);
  577. }
  578. }
  579. }
  580. }
  581. }
  582. }
  583.  
  584. /**
  585. * Top Header Info
  586. */
  587. function arilewp_top_header_info_register_strings() {
  588. arilewp_pll_string_register( 'arilewp_top_header_info_content', 'Theme Header Info' );
  589. }
  590.  
  591. /**
  592. * Top Header Social Icon
  593. */
  594. function arilewp_top_header_social_register_strings() {
  595. arilewp_pll_string_register( 'arilewp_top_header_social_content', 'Theme Header Social' );
  596. }
  597.  
  598. /**
  599. * Theme Info
  600. */
  601. function arilewp_theme_info_register_strings() {
  602. arilewp_pll_string_register( 'arilewp_theme_info_content', 'Theme Info Area' );
  603. }
  604.  
  605. /**
  606. * Main Slider.
  607. */
  608. function arilewp_main_slider_register_strings() {
  609. arilewp_pll_string_register( 'arilewp_main_slider_content', 'Theme Slider' );
  610. }
  611.  
  612. /**
  613. * Service
  614. */
  615. function arilewp_service_register_strings() {
  616. arilewp_pll_string_register( 'arilewp_service_content', 'Theme Service' );
  617. }
  618.  
  619. /**
  620. * Funfact
  621. */
  622. function arilewp_funfact_register_strings() {
  623. arilewp_pll_string_register( 'arilewp_funfact_content', 'Theme Funfact' );
  624. }
  625.  
  626. /**
  627. * Testimonial
  628. */
  629. function arilewp_testimonial_register_strings() {
  630. arilewp_pll_string_register( 'arilewp_testimonial_content', 'Theme Testimonial' );
  631. }
  632.  
  633. /**
  634. * Team
  635. */
  636. function arilewp_team_register_strings() {
  637. arilewp_pll_string_register( 'arilewp_team_content', 'Theme Team' );
  638. }
  639.  
  640. /**
  641. * Client
  642. */
  643. function arilewp_clients_register_strings() {
  644. arilewp_pll_string_register( 'arilewp_clients_content', 'Theme Client' );
  645. }
  646.  
  647. /**
  648. * Contact Info
  649. */
  650. function arilewp_contact_template_info_register_strings() {
  651. arilewp_pll_string_register( 'arilewp_contact_template_info_content', 'Theme Contact Info' );
  652. }
  653.  
  654. /**
  655. * Pll register
  656. */
  657. if ( function_exists( 'pll_register_string' ) ) {
  658. add_action( 'after_setup_theme', 'arilewp_top_header_info_register_strings', 11 );
  659. add_action( 'after_setup_theme', 'arilewp_top_header_social_register_strings', 11 );
  660. add_action( 'after_setup_theme', 'arilewp_theme_info_register_strings', 11 );
  661. add_action( 'after_setup_theme', 'arilewp_main_slider_register_strings', 11 );
  662. add_action( 'after_setup_theme', 'arilewp_service_register_strings', 11 );
  663. add_action( 'after_setup_theme', 'arilewp_funfact_register_strings', 11 );
  664. add_action( 'after_setup_theme', 'arilewp_testimonial_register_strings', 11 );
  665. add_action( 'after_setup_theme', 'arilewp_team_register_strings', 11 );
  666. add_action( 'after_setup_theme', 'arilewp_clients_register_strings', 11 );
  667. add_action( 'after_setup_theme', 'arilewp_contact_template_info_register_strings', 11 );
  668. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement