Advertisement
Guest User

Untitled

a guest
Jan 13th, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.66 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. <div <?php comment_class('media comment-box'); ?> id="comment-<?php comment_ID(); ?>">
  95. <a class="pull-left-comment">
  96. <?php echo get_avatar($comment); ?>
  97. </a>
  98. <div class="media-body">
  99. <div class="comment-detail">
  100. <h5 class="comment-detail-title"><?php printf(('%s'), get_comment_author_link()) ?>
  101. <time class="comment-date">
  102. <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) );?>">
  103. <?php comment_date('F j, Y');?>&nbsp;<?php esc_html_e('at','arilewp');?>&nbsp;<?php comment_time('g:i a'); ?>
  104. </a>
  105. </time></h5>
  106. <?php comment_text() ;?>
  107. <div class="reply">
  108. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  109. </div>
  110. <?php if ( $comment->comment_approved == '0' ) : ?>
  111. <em class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'arilewp' ); ?></em>
  112. <br/>
  113. <?php endif; ?>
  114. </div>
  115. </div>
  116. </div>
  117. <?php
  118. }
  119. endif;
  120. add_filter('get_avatar','arilewp_gravatar_class');
  121. function arilewp_gravatar_class($class) {
  122. $class = str_replace("class='avatar", "class='img-fluid comment-img", $class);
  123. return $class;
  124. }
  125.  
  126. function arilewp_read_more_button_class($read_class)
  127. { global $post;
  128. return '<p><a href="' . esc_url(get_permalink()) . "#more-{$post->ID}\" class=\"more-link\">" .esc_html__('Read More','arilewp')."</a></p>";
  129. }
  130. add_filter( 'the_content_more_link', 'arilewp_read_more_button_class' );
  131.  
  132. function arilewp_post_thumbnail() {
  133. if(has_post_thumbnail()){
  134. echo '<figure class="post-thumbnail"><a href="'.esc_url(get_the_permalink()).'">';
  135. the_post_thumbnail( '', array( 'class'=>'img-fluid' ) );
  136. echo '</a></figure>';
  137. }
  138. }
  139.  
  140. /**
  141. * Theme Page Header Title
  142. */
  143. function arilewp_theme_page_header_title(){
  144. $arilewp_page_header_layout = get_theme_mod('arilewp_page_header_layout', 'arilewp_page_header_layout1');
  145. if($arilewp_page_header_layout == 'arilewp_page_header_layout1'):
  146. $page_title_class = 'text-center';
  147. else: $page_title_class = '';
  148. endif;
  149. if( is_archive() )
  150. {
  151. echo '<div class="page-header-title '.$page_title_class.'"><h3 class="text-white">';
  152. if ( is_day() ) :
  153. printf( __( '%1$s %2$s', 'arilewp' ), __('Archives','arilewp'), get_the_date() );
  154. elseif ( is_month() ) :
  155. printf( __( '%1$s %2$s', 'arilewp' ), __('Archives','arilewp'), get_the_date( 'F Y' ) );
  156. elseif ( is_year() ) :
  157. printf( __( '%1$s %2$s', 'arilewp' ), __('Archives','arilewp'), get_the_date( 'Y' ) );
  158. elseif( is_author() ):
  159. printf( __( '%1$s %2$s', 'arilewp' ), __('All posts by','arilewp'), get_the_author() );
  160. elseif( is_category() ):
  161. printf( __( '%1$s %2$s', 'arilewp' ), __('Category','arilewp'), single_cat_title( '', false ) );
  162. elseif( is_tag() ):
  163. printf( __( '%1$s %2$s', 'arilewp' ), __('Tag','arilewp'), single_tag_title( '', false ) );
  164. elseif( class_exists( 'WooCommerce' ) && is_shop() ):
  165. printf( __( '%1$s %2$s', 'arilewp' ), __('Shop','arilewp'), single_tag_title( '', false ));
  166. elseif( is_archive() ):
  167. the_archive_title( '<h3 class="text-white">', '</h3>' );
  168. endif;
  169. echo '</h3></div>';
  170. }
  171. elseif( is_404() )
  172. {
  173. echo '<div class="page-header-title '.$page_title_class.'"><h3 class="text-white">';
  174. printf( __( '%1$s ', 'arilewp' ) , __('404','arilewp') );
  175. echo '</h3></div>';
  176. }
  177. elseif( is_search() )
  178. {
  179. echo '<div class="page-header-title '.$page_title_class.'"><h3 class="text-white">';
  180. printf( __( '%1$s %2$s', 'arilewp' ), __('Search results for','arilewp'), get_search_query() );
  181. echo '</h3></div>';
  182. }
  183. else
  184. {
  185. echo '<div class="page-header-title '.$page_title_class.'"><h3 class="text-white">'.get_the_title().'</h3></div>';
  186. }
  187. }
  188.  
  189. function arilewp_bootstrap_menu_notitle( $menu ){
  190. return $menu = preg_replace('/ title=\"(.*?)\"/', '', $menu );
  191. }
  192. add_filter( 'wp_nav_menu', 'arilewp_bootstrap_menu_notitle' );
  193.  
  194. /**
  195. * Theme Breadcrumbs Url
  196. */
  197. function arilewp_page_url() {
  198. $page_url = 'http';
  199. if ( key_exists("HTTPS", $_SERVER) && ( $_SERVER["HTTPS"] == "on" ) ){
  200. $page_url .= "s";
  201. }
  202. $page_url .= "://";
  203. if ($_SERVER["SERVER_PORT"] != "80") {
  204. $page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  205. } else {
  206. $page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  207. }
  208. return $page_url;
  209. }
  210.  
  211. /**
  212. * Theme Breadcrumbs
  213. */
  214. if( !function_exists('arilewp_page_header_breadcrumbs') ):
  215. function arilewp_page_header_breadcrumbs() {
  216. global $post;
  217. $homeLink = home_url();
  218. $arilewp_page_header_layout = get_theme_mod('arilewp_page_header_layout', 'arilewp_page_header_layout1');
  219. if($arilewp_page_header_layout == 'arilewp_page_header_layout1'):
  220. $breadcrumb_class = 'text-center';
  221. else: $breadcrumb_class = 'text-right';
  222. endif;
  223.  
  224. echo '<ul class="page-breadcrumb '.$breadcrumb_class.'">';
  225. if (is_home() || is_front_page()) :
  226. echo '<li><a href="'.$homeLink.'">'.__('Home','arilewp').'</a></li>';
  227. echo '<li class="active">'; echo single_post_title(); echo '</li>';
  228. else:
  229. echo '<li><a href="'.$homeLink.'">'.__('Home','arilewp').'</a></li>';
  230. if ( is_category() ) {
  231. echo '<li class="active"><a href="'. arilewp_page_url() .'">' . __('Archive by category','arilewp').' "' . single_cat_title('', false) . '"</a></li>';
  232. } elseif ( is_day() ) {
  233. echo '<li class="active"><a href="'. get_year_link(get_the_time('Y')) . '">'. get_the_time('Y') .'</a>';
  234. echo '<li class="active"><a href="'. get_month_link(get_the_time('Y'),get_the_time('m')) .'">'. get_the_time('F') .'</a>';
  235. echo '<li class="active"><a href="'. arilewp_page_url() .'">'. get_the_time('d') .'</a></li>';
  236. } elseif ( is_month() ) {
  237. echo '<li class="active"><a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>';
  238. echo '<li class="active"><a href="'. arilewp_page_url() .'">'. get_the_time('F') .'</a></li>';
  239. } elseif ( is_year() ) {
  240. echo '<li class="active"><a href="'. arilewp_page_url() .'">'. get_the_time('Y') .'</a></li>';
  241. } elseif ( is_single() && !is_attachment() && is_page('single-product') ) {
  242. if ( get_post_type() != 'post' ) {
  243. $cat = get_the_category();
  244. $cat = $cat[0];
  245. echo '<li>';
  246. echo get_category_parents($cat, TRUE, '');
  247. echo '</li>';
  248. echo '<li class="active"><a href="' . arilewp_page_url() . '">'. wp_title( '',false ) .'</a></li>';
  249. } }
  250. elseif ( is_page() && $post->post_parent ) {
  251. $parent_id = $post->post_parent;
  252. $breadcrumbs = array();
  253. while ($parent_id) {
  254. $page = get_page($parent_id);
  255. $breadcrumbs[] = '<li class="active"><a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
  256. $parent_id = $page->post_parent;
  257. }
  258. $breadcrumbs = array_reverse($breadcrumbs);
  259. foreach ($breadcrumbs as $crumb) echo $crumb;
  260. echo '<li class="active"><a href="' . arilewp_page_url() . '">'. get_the_title() .'</a></li>';
  261. }
  262. elseif( is_search() )
  263. {
  264. echo '<li class="active"><a href="' . arilewp_page_url() . '">'. get_search_query() .'</a></li>';
  265. }
  266. elseif( is_404() )
  267. {
  268. echo '<li class="active"><a href="' . arilewp_page_url() . '">'.__('Error 404','arilewp').'</a></li>';
  269. }
  270. else {
  271. echo '<li class="active"><a href="' . arilewp_page_url() . '">'. get_the_title() .'</a></li>';
  272. }
  273. endif;
  274. echo '</ul>';
  275. }
  276. endif;
  277.  
  278. /*
  279. * Import customizer options from Lite version
  280. */
  281. add_action( 'after_switch_theme', 'arilewp_merge_lite_options' );
  282. /**
  283. * Import lite options.
  284. */
  285. function arilewp_merge_lite_options() {
  286.  
  287. $arilewp_mods = get_option( 'theme_mods_arilewp' );
  288.  
  289. if ( ! empty( $arilewp_mods ) ) {
  290.  
  291. foreach ( $arilewp_mods as $arilewp_mod_k => $arilewp_mod_v ) {
  292. set_theme_mod( $arilewp_mod_k, $arilewp_mod_v );
  293. }
  294. }
  295. }
  296.  
  297. add_action( 'after_switch_theme', 'arilewp_import_theme_mods_from_child_theme_to_pro_theme' );
  298.  
  299. /**
  300. * Import theme options from child theme to ArileWP Pro theme
  301. */
  302. function arilewp_import_theme_mods_from_child_theme_to_pro_theme() {
  303.  
  304. // Get the name of the previously active theme.
  305. $previous_theme = strtolower( get_option( 'theme_switched' ) );
  306.  
  307. if ( ! in_array(
  308. $previous_theme, array(
  309. 'business-street',
  310. 'strangerwp',
  311. 'newyork-city',
  312. 'arilewp-child-theme',
  313. 'interiorpress',
  314. 'architect-design',
  315. 'ariletech',
  316. 'decorpress',
  317. 'fresno',
  318. 'designhub',
  319. 'alberta',
  320. 'architecto',
  321. 'innopress',
  322. 'agency-street',
  323. 'etowah',
  324. 'roseville-blog',
  325. 'zervin',
  326. 'interior-startup',
  327. 'sayre',
  328. 'agency-firm',
  329. 'interior-space',
  330. )
  331. ) ) {
  332. return;
  333. }
  334.  
  335. // Get the theme mods from the previous theme.
  336. $previous_theme_content = get_option( 'theme_mods_' . $previous_theme );
  337.  
  338. if ( ! empty( $previous_theme_content ) ) {
  339. foreach ( $previous_theme_content as $previous_theme_mod_k => $previous_theme_mod_v ) {
  340. set_theme_mod( $previous_theme_mod_k, $previous_theme_mod_v );
  341. }
  342. }
  343. }
  344.  
  345. /**
  346. * Import lite project options.
  347. */
  348. $merge_project_lite_options = get_option( 'merge_project_lite_options' , 'lite');
  349. $arilewp_project_content = get_theme_mod( 'arilewp_project_content');
  350. if ( ! empty( $arilewp_project_content ) ) {
  351. if ( $merge_project_lite_options === 'lite' ) {
  352. $allowed_html = array('br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(),'i' => array());
  353. $arilewp_project_content = json_decode($arilewp_project_content);
  354. foreach ( $arilewp_project_content as $project_item ) {
  355. $image_url = ! empty( $project_item->image_url ) ? $project_item->image_url : '';
  356. $title = ! empty( $project_item->title ) ? $project_item->title : '';
  357. $text = ! empty( $project_item->text ) ? $project_item->text : '';
  358.  
  359. if(!empty($title)){
  360. $post_id = wp_insert_post(
  361. array (
  362. 'post_type' => 'arilewp_portfolio',
  363. 'post_title' => $title,
  364. 'post_status' => 'publish',
  365. ));
  366. $filename = $image_url;
  367. $filetype = wp_check_filetype( basename( $filename ), null );
  368. $wp_upload_dir = wp_upload_dir();
  369. $attachment = array(
  370. 'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),
  371. 'post_mime_type' => $filetype['type'],
  372. 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
  373. 'post_content' => '',
  374. 'post_status' => 'inherit'
  375. );
  376. $attach_id = wp_insert_attachment( $attachment, $filename, $post_id );
  377. set_post_thumbnail( $post_id, $attach_id );
  378. update_post_meta($post_id, 'custom_portfolio_description', sanitize_text_field($text));
  379. $table_name = $wpdb->prefix . "term_relationships";
  380. $wpdb->insert($table_name, array('object_id' => $post_id, 'term_taxonomy_id' => 2 ,'term_order' => 0) );
  381. }
  382. }
  383. update_option( 'merge_project_lite_options', 'update' );
  384. }
  385.  
  386. }
  387.  
  388.  
  389. /**
  390. * Blog Masonry
  391. */
  392. function arilewp_custom_script()
  393. {
  394. wp_reset_query();
  395. $col =6;
  396. if(is_page_template('page-templates/blog-masonry-2-col.php'))
  397. { $col =6; }
  398. elseif(is_page_template('page-templates/blog-masonry-3-col.php'))
  399. { $col =4; }
  400. elseif(is_page_template('page-templates/blog-masonry-4-col.php'))
  401. { $col =3; }
  402. ?>
  403. <script>
  404. jQuery(document).ready(function ( jQuery ) {
  405. jQuery("#blog-masonry").mpmansory(
  406. {
  407. childrenClass: 'item', // default is a div
  408. columnClasses: 'padding', //add classes to items
  409. breakpoints:{
  410. xl: <?php echo $col; ?>, //Change masonry column here like 2, 3, 4 column
  411. lg: 4,
  412. md: 6,
  413. sm: 12,
  414. xs: 12
  415. },
  416. 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'
  417. onload: function (items) {
  418. //make somthing with items
  419. }
  420. }
  421. );
  422. });
  423. </script>
  424. <?php
  425. }
  426. add_action('wp_footer','arilewp_custom_script');
  427.  
  428.  
  429. function arilewp_background_image()
  430. {
  431. $theme_boxed_image = get_theme_mod('arilewp_theme_background_image','bg-patternm1');
  432. if($theme_boxed_image!='')
  433. {
  434. if($theme_boxed_image == 'bg-patternm1' || $theme_boxed_image == 'bg-patternm2' || $theme_boxed_image == 'bg-patternm3' || $theme_boxed_image == 'bg-patternm4'){ $image_format = 'png';}
  435. else { $image_format = 'jpg'; }
  436. echo '<style>body.theme-boxed{ background:url("'.ARILEWP_PARENT_INC_ICON_URI.'/'.$theme_boxed_image.'.'.$image_format.'") repeat fixed;}</style>';
  437. }
  438. }
  439. add_action('wp_head','arilewp_background_image',10,0);
  440.  
  441. /**
  442. * Add object term default
  443. */
  444. function arilewp_default_object_terms( $post_id, $post ) {
  445. if ( 'publish' === $post->post_status && $post->post_type === 'arilewp_portfolio' ) {
  446. $defaults = array( 'portfolio_categories' => array( 'Show All' ) );
  447. $taxonomies = get_object_taxonomies( $post->post_type );
  448. foreach ( (array) $taxonomies as $taxonomy ) {
  449. $terms = wp_get_post_terms( $post_id, $taxonomy );
  450. if ( empty( $terms ) && array_key_exists( $taxonomy, $defaults ) ) {
  451. wp_set_object_terms( $post_id, $defaults[$taxonomy], $taxonomy );
  452. }
  453. }
  454. }
  455. }
  456. add_action( 'save_post', 'arilewp_default_object_terms', 0, 2 );
  457.  
  458. /**
  459. * Custom Theme Script
  460. */
  461. function arilewp_custom_owl_theme_scripts() {
  462. $arilewp_main_slider_aniamte_type = get_theme_mod('arilewp_main_slider_aniamte_type', 'slide');
  463. if($arilewp_main_slider_aniamte_type == 'fade'):
  464. $arilewp_main_slider_aniamte_in = 'fadeIn'; $arilewp_main_slider_aniamte_out = 'fadeOut';
  465. else:
  466. $arilewp_main_slider_aniamte_in = ''; $arilewp_main_slider_aniamte_out = '';
  467. endif;
  468. $arilewp_main_slider_scroll_speed = get_theme_mod('arilewp_main_slider_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  469. $arilewp_main_slider_smart_speed = get_theme_mod('arilewp_main_slider_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  470. $arilewp_main_slider_mouse_drag_disabled = get_theme_mod('arilewp_main_slider_mouse_drag_disabled', true);
  471.  
  472. $arilewp_project_scroll_speed = get_theme_mod('arilewp_project_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  473. $arilewp_project_smart_speed = get_theme_mod('arilewp_project_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  474. $arilewp_project_mouse_drag_disabled = get_theme_mod('arilewp_project_mouse_drag_disabled', true);
  475. $arilewp_project_column_layout = get_theme_mod('arilewp_project_column_layout', '4');
  476.  
  477. $arilewp_testimonial_scroll_speed = get_theme_mod('arilewp_testimonial_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  478. $arilewp_testimonial_smart_speed = get_theme_mod('arilewp_testimonial_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  479. $arilewp_testimonial_mouse_drag_disabled = get_theme_mod('arilewp_testimonial_mouse_drag_disabled', true);
  480. $arilewp_testimonial_column_layout = get_theme_mod('arilewp_testimonial_column_layout', '3');
  481.  
  482. $arilewp_wooshop_scroll_speed = get_theme_mod('arilewp_wooshop_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  483. $arilewp_wooshop_smart_speed = get_theme_mod('arilewp_wooshop_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  484. $arilewp_wooshop_mouse_drag_disabled = get_theme_mod('arilewp_wooshop_mouse_drag_disabled', true);
  485. $arilewp_wooshop_column_layout = get_theme_mod('arilewp_wooshop_column_layout', '4');
  486.  
  487. $arilewp_team_scroll_speed = get_theme_mod('arilewp_team_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  488. $arilewp_team_smart_speed = get_theme_mod('arilewp_team_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  489. $arilewp_team_mouse_drag_disabled = get_theme_mod('arilewp_team_mouse_drag_disabled', true);
  490. $arilewp_team_column_layout = get_theme_mod('arilewp_team_column_layout', '3');
  491.  
  492. $arilewp_client_scroll_speed = get_theme_mod('arilewp_client_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
  493. $arilewp_client_smart_speed = get_theme_mod('arilewp_client_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
  494. $arilewp_client_mouse_drag_disabled = get_theme_mod('arilewp_client_mouse_drag_disabled', true);
  495. $arilewp_client1_column_layout = get_theme_mod('arilewp_client1_column_layout', '5');
  496.  
  497. $custom_data = array(
  498. 'arilewp_main_slider_aniamte_in' => $arilewp_main_slider_aniamte_in,
  499. 'arilewp_main_slider_aniamte_out' => $arilewp_main_slider_aniamte_out,
  500. 'arilewp_main_slider_scroll_speed' => $arilewp_main_slider_scroll_speed['slider'],
  501. 'arilewp_main_slider_smart_speed' => $arilewp_main_slider_smart_speed['slider'],
  502. 'arilewp_main_slider_mouse_drag_disabled' => $arilewp_main_slider_mouse_drag_disabled,
  503. 'arilewp_project_scroll_speed' => $arilewp_project_scroll_speed['slider'],
  504. 'arilewp_project_smart_speed' => $arilewp_project_smart_speed['slider'],
  505. 'arilewp_project_mouse_drag_disabled' => $arilewp_project_mouse_drag_disabled,
  506. 'arilewp_project_column_layout' => $arilewp_project_column_layout,
  507. 'arilewp_testimonial_scroll_speed' => $arilewp_testimonial_scroll_speed['slider'],
  508. 'arilewp_testimonial_smart_speed' => $arilewp_testimonial_smart_speed['slider'],
  509. 'arilewp_testimonial_mouse_drag_disabled' => $arilewp_testimonial_mouse_drag_disabled,
  510. 'arilewp_testimonial_column_layout' => $arilewp_testimonial_column_layout,
  511. 'arilewp_wooshop_scroll_speed' => $arilewp_wooshop_scroll_speed['slider'],
  512. 'arilewp_wooshop_smart_speed' => $arilewp_wooshop_smart_speed['slider'],
  513. 'arilewp_wooshop_mouse_drag_disabled' => $arilewp_wooshop_mouse_drag_disabled,
  514. 'arilewp_wooshop_column_layout' => $arilewp_wooshop_column_layout,
  515. 'arilewp_team_scroll_speed' => $arilewp_team_scroll_speed['slider'],
  516. 'arilewp_team_smart_speed' => $arilewp_team_smart_speed['slider'],
  517. 'arilewp_team_mouse_drag_disabled' => $arilewp_team_mouse_drag_disabled,
  518. 'arilewp_team_column_layout' => $arilewp_team_column_layout,
  519. 'arilewp_client_scroll_speed' => $arilewp_client_scroll_speed['slider'],
  520. 'arilewp_client_smart_speed' => $arilewp_client_smart_speed['slider'],
  521. 'arilewp_client_mouse_drag_disabled' => $arilewp_client_mouse_drag_disabled,
  522. 'arilewp_client1_column_layout' => $arilewp_client1_column_layout,
  523. );
  524.  
  525. wp_register_script('arilewp-custom',get_template_directory_uri().'/assets/js/custom.js',array('jquery'));
  526. wp_localize_script('arilewp-custom','custom_data',$custom_data);
  527. wp_enqueue_script('arilewp-custom');
  528. }
  529. add_action( 'wp_enqueue_scripts', 'arilewp_custom_owl_theme_scripts' );
  530.  
  531. /**
  532. * Theme Pagination Class.
  533. */
  534. class Class_ArileWP_Theme_Pagination
  535. {
  536. function arilewp_pagination()
  537. {
  538. global $post;
  539. global $wp_query, $wp_rewrite,$loop;
  540. if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
  541. elseif ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); } else { $paged = 1; }
  542. if($wp_query->max_num_pages==0){ $wp_query = $loop; }
  543. ?>
  544. <div class="pagination wow animate fadeInUp" data-wow-delay=".3s">
  545. <?php if( $paged != 1 ) : ?>
  546. <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 } ?>
  547. <?php if($wp_query->max_num_pages!= $paged): ?>
  548. <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>
  549. <?php endif; ?>
  550. </div>
  551. <?php
  552. }
  553. }
  554.  
  555. /**
  556. * Add WPML and Polylang compatibility.
  557. */
  558.  
  559. function arilewp_translate_single_string( $original_value, $domain ) {
  560. if ( is_customize_preview() ) {
  561. $wpml_translation = $original_value;
  562. } else {
  563. $wpml_translation = apply_filters( 'wpml_translate_single_string', $original_value, $domain, $original_value );
  564. if ( $wpml_translation === $original_value && function_exists( 'pll__' ) ) {
  565. return pll__( $original_value );
  566. }
  567. }
  568. return $wpml_translation;
  569. }
  570. add_filter( 'arilewp_translate_single_string', 'arilewp_translate_single_string', 10, 2 );
  571.  
  572. /**
  573. * register pll string.
  574. */
  575. function arilewp_pll_string_register( $theme_mod ) {
  576. if ( ! function_exists( 'pll_register_string' ) ) { return; }
  577. $repeater_content = get_theme_mod( $theme_mod );
  578. $repeater_content = json_decode( $repeater_content );
  579. if ( ! empty( $repeater_content ) ) {
  580. foreach ( $repeater_content as $repeater_item ) {
  581. foreach ( $repeater_item as $field_name => $field_value ) {
  582. if ( $field_value !== 'undefined' ) {
  583. if ( $field_name !== 'id' ) {
  584. $f_n = ucfirst( $field_name );
  585. pll_register_string( $f_n, $field_value);
  586. }
  587. }
  588. }
  589. }
  590. }
  591. }
  592.  
  593. /**
  594. * Top Header Info
  595. */
  596. function arilewp_top_header_info_register_strings() {
  597. arilewp_pll_string_register( 'arilewp_top_header_info_content', 'Theme Header Info' );
  598. }
  599.  
  600. /**
  601. * Top Header Social Icon
  602. */
  603. function arilewp_top_header_social_register_strings() {
  604. arilewp_pll_string_register( 'arilewp_top_header_social_content', 'Theme Header Social' );
  605. }
  606.  
  607. /**
  608. * Theme Info
  609. */
  610. function arilewp_theme_info_register_strings() {
  611. arilewp_pll_string_register( 'arilewp_theme_info_content', 'Theme Info Area' );
  612. }
  613.  
  614. /**
  615. * Main Slider.
  616. */
  617. function arilewp_main_slider_register_strings() {
  618. arilewp_pll_string_register( 'arilewp_main_slider_content', 'Theme Slider' );
  619. }
  620.  
  621. /**
  622. * Service
  623. */
  624. function arilewp_service_register_strings() {
  625. arilewp_pll_string_register( 'arilewp_service_content', 'Theme Service' );
  626. }
  627.  
  628. /**
  629. * Funfact
  630. */
  631. function arilewp_funfact_register_strings() {
  632. arilewp_pll_string_register( 'arilewp_funfact_content', 'Theme Funfact' );
  633. }
  634.  
  635. /**
  636. * Testimonial
  637. */
  638. function arilewp_testimonial_register_strings() {
  639. arilewp_pll_string_register( 'arilewp_testimonial_content', 'Theme Testimonial' );
  640. }
  641.  
  642. /**
  643. * Team
  644. */
  645. function arilewp_team_register_strings() {
  646. arilewp_pll_string_register( 'arilewp_team_content', 'Theme Team' );
  647. }
  648.  
  649. /**
  650. * Client
  651. */
  652. function arilewp_clients_register_strings() {
  653. arilewp_pll_string_register( 'arilewp_clients_content', 'Theme Client' );
  654. }
  655.  
  656. /**
  657. * Contact Info
  658. */
  659. function arilewp_contact_template_info_register_strings() {
  660. arilewp_pll_string_register( 'arilewp_contact_template_info_content', 'Theme Contact Info' );
  661. }
  662.  
  663. /**
  664. * Pll register
  665. */
  666. if ( function_exists( 'pll_register_string' ) ) {
  667. add_action( 'after_setup_theme', 'arilewp_top_header_info_register_strings', 11 );
  668. add_action( 'after_setup_theme', 'arilewp_top_header_social_register_strings', 11 );
  669. add_action( 'after_setup_theme', 'arilewp_theme_info_register_strings', 11 );
  670. add_action( 'after_setup_theme', 'arilewp_main_slider_register_strings', 11 );
  671. add_action( 'after_setup_theme', 'arilewp_service_register_strings', 11 );
  672. add_action( 'after_setup_theme', 'arilewp_funfact_register_strings', 11 );
  673. add_action( 'after_setup_theme', 'arilewp_testimonial_register_strings', 11 );
  674. add_action( 'after_setup_theme', 'arilewp_team_register_strings', 11 );
  675. add_action( 'after_setup_theme', 'arilewp_clients_register_strings', 11 );
  676. add_action( 'after_setup_theme', 'arilewp_contact_template_info_register_strings', 11 );
  677. }
  678.  
  679. /**
  680. * Import data
  681. */
  682. function arilewp_pro_ocdi_import_files() {
  683. return array(
  684. array(
  685. 'import_file_name' => 'Demo 1',
  686. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo1/arilewp-pro.xml',
  687. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo1/widgets.wie',
  688. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo1/customizer.dat',
  689. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-one.jpg',
  690. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  691. 'preview_url' => 'https://arilewp-pro.themearile.com/',
  692. ),
  693. array(
  694. 'import_file_name' => 'Demo 2',
  695. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo2/arilewp-pro.xml',
  696. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo2/widgets.wie',
  697. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo2/customizer.dat',
  698. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-two.jpg',
  699. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  700. 'preview_url' => 'https://arilewp-pro-two.themearile.com/',
  701. ),
  702. array(
  703. 'import_file_name' => 'Demo 3',
  704. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo3/arilewp-pro.xml',
  705. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo3/widgets.wie',
  706. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo3/customizer.dat',
  707. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-three.jpg',
  708. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  709. 'preview_url' => 'https://arilewp-pro-three.themearile.com/',
  710. ),
  711. array(
  712. 'import_file_name' => 'Demo 4',
  713. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo4/arilewp-pro.xml',
  714. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo4/widgets.wie',
  715. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo4/customizer.dat',
  716. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-four.jpg',
  717. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  718. 'preview_url' => 'https://arilewp-pro-four.themearile.com/',
  719. ),
  720. array(
  721. 'import_file_name' => 'Demo 5',
  722. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo5/arilewp-pro.xml',
  723. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo5/widgets.wie',
  724. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo5/customizer.dat',
  725. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-five.jpg',
  726. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  727. 'preview_url' => 'https://arilewp-pro-five.themearile.com/',
  728. ),
  729. array(
  730. 'import_file_name' => 'Demo 6',
  731. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo6/arilewp-pro.xml',
  732. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo6/widgets.wie',
  733. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo6/customizer.dat',
  734. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-six.jpg',
  735. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  736. 'preview_url' => 'https://arilewp-pro-six.themearile.com/',
  737. ),
  738. array(
  739. 'import_file_name' => 'Demo 7',
  740. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo7/arilewp-pro.xml',
  741. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo7/widgets.wie',
  742. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo7/customizer.dat',
  743. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-seven.jpg',
  744. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  745. 'preview_url' => 'https://arilewp-pro-seven.themearile.com/',
  746. ),
  747. array(
  748. 'import_file_name' => 'Demo 8',
  749. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo8/arilewp-pro.xml',
  750. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo8/widgets.wie',
  751. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo8/customizer.dat',
  752. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-eight.jpg',
  753. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  754. 'preview_url' => 'https://arilewp-pro-eight.themearile.com/',
  755. ),
  756. array(
  757. 'import_file_name' => 'Demo 9',
  758. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo9/arilewp-pro.xml',
  759. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo9/widgets.wie',
  760. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo9/customizer.dat',
  761. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-nine.jpg',
  762. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  763. 'preview_url' => 'https://arilewp-pro-nine.themearile.com/',
  764. ),
  765. array(
  766. 'import_file_name' => 'Demo 10',
  767. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo10/arilewp-pro.xml',
  768. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo10/widgets.wie',
  769. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo10/customizer.dat',
  770. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-ten.jpg',
  771. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  772. 'preview_url' => 'https://arilewp-pro-ten.themearile.com/',
  773. ),
  774. array(
  775. 'import_file_name' => 'Demo 11',
  776. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo11/arilewp-pro.xml',
  777. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo11/widgets.wie',
  778. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo11/customizer.dat',
  779. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-eleven.jpg',
  780. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  781. 'preview_url' => 'https://arilewp-pro-eleven.themearile.com/',
  782. ),
  783. array(
  784. 'import_file_name' => 'Demo 12',
  785. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo12/arilewp-pro.xml',
  786. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo12/widgets.wie',
  787. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo12/customizer.dat',
  788. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-twelve.jpg',
  789. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  790. 'preview_url' => 'https://arilewp-pro-twelve.themearile.com/',
  791. ),
  792. array(
  793. 'import_file_name' => 'Demo 13',
  794. 'import_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo13/arilewp-pro.xml',
  795. 'import_widget_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo13/widgets.wie',
  796. 'import_customizer_file_url' => 'https://themearile.com/demo-data/arilewp-pro-data/demo13/customizer.dat',
  797. 'import_preview_image_url' => 'https://themearile.com/wp-content/themes/themearile-pro/assets/img/arilewp-pro/homepage-thirteen.jpg',
  798. 'import_notice' => __( 'After you import this demo, you will have to set the menus.', 'arilewp' ),
  799. 'preview_url' => 'https://arilewp-pro-thirteen.themearile.com/',
  800. ),
  801. );
  802. }
  803. add_filter( 'pt-ocdi/import_files', 'arilewp_pro_ocdi_import_files' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement