Submit
Path:
~
/
home
/
getwphos
/
public_html
/
techniquetechs
/
wp-content
/
themes
/
plexify
/
elements
/
File Content:
element-templates.php
<?php use Elementor\Controls_Manager; use Elementor\Embed; use Elementor\Group_Control_Image_Size; add_action( 'wp_ajax_plexify_load_more_post_grid', 'plexify_load_more_post_grid' ); add_action( 'wp_ajax_nopriv_plexify_load_more_post_grid', 'plexify_load_more_post_grid' ); function plexify_load_more_post_grid(){ if ( ! check_ajax_referer( '_ajax_nonce', 'wpnonce' ) || empty( sanitize_text_field( wp_unslash($_POST['wpnonce'] ))) ) { wp_send_json( array( 'status' => false, 'message' => esc_attr__('Nonce error, please reload.', 'plexify'), 'data' => array(), ) ); } try{ if(!isset($_POST['settings']) || !function_exists('pxl_get_request_data')){ throw new Exception(__('Something went wrong while requesting. Please try again!', 'plexify')); } $settings = pxl_get_request_data($_POST, 'settings'); $source = isset($settings['source']) ? sanitize_text_field($settings['source']) : ''; $term_slug = isset($settings['term_slug']) ? sanitize_text_field($settings['term_slug']) : ''; if( !empty($term_slug) && $term_slug !='*'){ $term_slug = str_replace('.', '', $term_slug); $source = [$term_slug.'|'.sanitize_text_field($settings['tax'][0])]; } if( isset($_POST['handler_click']) && sanitize_text_field(wp_unslash( $_POST[ 'handler_click' ] )) == 'filter'){ set_query_var('paged', 1); $settings['paged'] = 1; }else{ set_query_var('paged', (int)$settings['paged']); } extract(pxl_get_posts_of_grid($settings['post_type'], [ 'source' => $source, 'orderby' => isset($settings['orderby']) ? sanitize_text_field($settings['orderby']) : 'date', 'order' => isset($settings['order']) ? ($settings['orderby'] == 'title' ? 'asc' : sanitize_text_field($settings['order']) ) : 'desc', 'limit' => isset($settings['limit']) ? (int)$settings['limit'] : 6, 'post_ids' => isset($settings['post_ids']) ? $settings['post_ids']: [], 'post_not_in' => isset($settings['post_not_in']) ? $settings['post_not_in'] : [], ], $settings['tax'] )); ob_start(); plexify_get_post_grid($posts, $settings); $html = ob_get_clean(); $pagin_html = ''; if( isset($settings['pagination_type']) && $settings['pagination_type'] == 'pagination' ){ ob_start(); plexify()->page->get_pagination( $query, true ); $pagin_html = ob_get_clean(); } wp_send_json( array( 'status' => true, 'message' => esc_attr__('Load Successfully!', 'plexify'), 'data' => array( 'html' => $html, 'paged' => (int)$settings['paged'], 'pagin_html' => $pagin_html, 'posts' => $posts, 'max' => $max ) ) ); } catch (Exception $e){ wp_send_json(array('status' => false, 'message' => $e->getMessage())); } die; } function plexify_get_post_grid($posts = [], $settings = []){ if (empty($posts)) return; switch ($settings['layout']) { case 'post-1': plexify_get_post_grid_layout1($posts, $settings); break; case 'services-1': plexify_get_sercices_grid_layout1($posts, $settings); break; case 'services-2': plexify_get_sercices_grid_layout2($posts, $settings); break; default: return false; break; } } function plexify_get_post_grid_layout1($posts = [], $settings = []){ extract($settings); foreach ($posts as $key => $post): if (has_post_thumbnail($post->ID) && wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), false)){ $img_id = get_post_thumbnail_id($post->ID); if($img_id){ $img = pxl_get_image_by_size( array( 'attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => 'object-fit no-lazyload', )); $thumbnail = $img['thumbnail']; }else{ $thumbnail = get_the_post_thumbnail($post->ID, $img_size); } }else{ $thumbnail = ''; } $filter_class = ''; if ($select_post_by === 'term_selected' && $filter == "true") $filter_class = pxl_get_term_of_post_to_class($post->ID, array_unique($tax)); $author_id = get_post_field ('post_author', $post->ID); ?> <div class="<?php echo esc_attr('grid-item'); ?>"> <div class="grid-item-wrap"> <div class="grid-item-inner item-inner-wrap"> <?php if ( !empty( $thumbnail )): ?> <div class="item-featured"> <div class="post-image scale-hover-x"> <?php echo wp_kses_post($thumbnail); ?> </div> </div> <?php endif; ?> <div class="item-content"> <div class="item-title-meta"> <h4 class="item-title"><a href="<?php echo esc_url(get_permalink( $post->ID )); ?>"><?php echo esc_html(get_the_title($post->ID)); ?></a></h4> <div class="item-meta"> <?php if( $show_date): ?> <span class="item-date"><?php echo get_the_date('j M Y', $post->ID); ?></span> <?php endif; ?> <span class="pxl-dash"></span> <?php if( $show_author): ?> <span class="item-name"><?php echo esc_html('by ', 'plexify'); ?> <a href="<?php echo esc_url(get_author_posts_url($author_id)); ?>" class="pxl-author-link"> <?php echo esc_attr(''.get_the_author_meta('display_name', $author_id)); ?> </a> </span> <?php endif; ?> </div> </div> <?php if( $show_readmore): ?> <div class="post-readmore"> <a class="pxl-readmore" href="<?php echo esc_url( get_permalink($post->ID)); ?>"> <?php if( !empty( $readmore_icon['value'])): ?> <span class="pxl-icon"><?php \Elementor\Icons_Manager::render_icon( $readmore_icon, [ 'aria-hidden' => 'true']); ?></span> <?php endif; ?> </a> </div> <?php endif; ?> </div> </div> </div> </div> <?php endforeach; } function plexify_get_sercices_grid_layout1($posts = [], $settings = []){ extract($settings); foreach ($posts as $key => $post): $filter_class = ''; if ($select_post_by === 'term_selected' && $filter == "true") $filter_class = pxl_get_term_of_post_to_class($post->ID, array_unique($tax)); $service_icon = get_post_meta( $post->ID, 'service_icon', true ); $readmore_text = !empty($readmore_text) ? $readmore_text : esc_html__('Read More', 'plexify'); ?> <div class="<?php echo esc_attr('grid-item'); ?>"> <div class="grid-item-wrap"> <div class="grid-item-inner item-inner-wrap"> <?php if (!empty($service_icon['url'])): if (strpos($service_icon['url'], '.svg') !== false): $svg_content = file_get_contents($service_icon['url']) ? file_get_contents($service_icon['url']) : ''; if ($svg_content): ?> <span class="service-icon"><?php pxl_print_html($svg_content) ?></span> <?php endif; else: ?> <span class="service-icon"><img src="<?php echo esc_url($service_icon['url']); ?>" alt="Service Icon"></span> <?php endif; endif;?> <div class="item-content"> <h4 class="item-title"><a href="<?php echo esc_url(get_permalink( $post->ID )); ?>"><?php echo esc_html(get_the_title($post->ID)); ?></a></h4> <?php if($show_excerpt) : ?> <div class="item-excerpt"> <?php if(!empty($post->post_excerpt)){ echo wp_trim_words( $post->post_excerpt, $num_words, null ); } else{ $content = strip_shortcodes( $post->post_content ); $content = apply_filters( 'the_content', $content ); $content = str_replace(']]>', ']]>', $content); echo wp_trim_words( $content, $num_words, null ); } ?> </div> <?php endif; ?> <?php if( $show_readmore): ?> <div class="service-readmore"> <a class="pxl-readmore" href="<?php echo esc_url( get_permalink($post->ID)); ?>"> <span class="pxl-button-text"><?php echo plexify_html($readmore_text); ?></span> <?php if( !empty( $readmore_icon['value'])): ?> <span class="pxl-icon"><?php \Elementor\Icons_Manager::render_icon( $readmore_icon, [ 'aria-hidden' => 'true']); ?></span> <?php endif; ?> </a> </div> <?php endif; ?> <?php if( $show_divider): ?> <span class="pxl-divider"></span> <?php endif; ?> <?php if( $show_category): ?> <span class="service-category col-auto d-flex"><?php the_terms( $post->ID, 'services-category', '', ' ', '' ); ?></span> <?php endif; ?> </div> </div> </div> </div> <?php endforeach; } function plexify_get_sercices_grid_layout2($posts = [], $settings = []){ extract($settings); $number = 1; foreach ($posts as $key => $post): $filter_class = ''; if ($select_post_by === 'term_selected' && $filter == "true") $filter_class = pxl_get_term_of_post_to_class($post->ID, array_unique($tax)); $service_icon = get_post_meta( $post->ID, 'service_icon', true ); $readmore_text = !empty($readmore_text) ? $readmore_text : esc_html__('Read More', 'plexify'); ?> <div class="<?php echo esc_attr('grid-item'); ?>"> <div class="grid-item-wrap"> <div class="grid-item-inner item-inner-wrap"> <div class="item-content"> <?php if (!empty($service_icon['url'])): if (strpos($service_icon['url'], '.svg') !== false): $svg_content = file_get_contents($service_icon['url']) ? file_get_contents($service_icon['url']) : ''; if ($svg_content): ?> <span class="service-icon"><?php pxl_print_html($svg_content) ?></span> <?php endif; else: ?> <span class="service-icon"><img src="<?php echo esc_url($service_icon['url']); ?>" alt="Service Icon"></span> <?php endif; endif;?> <div class="content-item"> <div class="item-title-meta"> <h3 class="item-title"><a href="<?php echo esc_url(get_permalink( $post->ID )); ?>"><?php echo esc_html(get_the_title($post->ID)); ?></a></h3> </div> <?php if($show_excerpt) : ?> <div class="item-excerpt"> <?php if(!empty($post->post_excerpt)){ echo wp_trim_words( $post->post_excerpt, $num_words, null ); } else{ $content = strip_shortcodes( $post->post_content ); $content = apply_filters( 'the_content', $content ); $content = str_replace(']]>', ']]>', $content); echo wp_trim_words( $content, $num_words, null ); } ?> </div> <?php endif; ?> </div> </div> <div class="item-category"> <span class="item-number"><?php echo esc_html(sprintf('%02d', $number)); ?></span> <?php if( $show_category): ?> <span class="service-category col-auto d-flex"><?php the_terms( $post->ID, 'services-category', '', ' ', '' ); ?></span> <?php endif; ?> </div> </div> </div> </div> <?php $number++; endforeach; } function plexify_get_post_list($posts = [], $settings = []){ if (empty($posts) || !is_array($posts) || empty($settings) || !is_array($settings)) { return; } extract($settings); switch ($settings['layout']) { case 'post-list-1': plexify_get_post_list_layout1($posts, $settings); break; case 'post-list-2': plexify_get_post_list_layout2($posts, $settings); break; case 'services-list-1': plexify_get_services_list_layout1($posts, $settings); break; case 'services-list-2': plexify_get_services_list_layout2($posts, $settings); break; default: return false; break; } } function plexify_get_post_list_layout1($posts = [], $settings = []){ extract($settings); foreach ($posts as $key => $post): if (has_post_thumbnail($post->ID) && wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), false)){ $img_id = get_post_thumbnail_id($post->ID); if($img_id){ $img = pxl_get_image_by_size( array( 'attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => 'no-lazyload', )); $thumbnail = $img['thumbnail']; }else{ $thumbnail = get_the_post_thumbnail($post->ID, $img_size); } }else{ $thumbnail = ''; } $author = get_user_by('id', $post->post_author); $date_format = get_option('date_format'); $data_settings = ''; $animate_cls = ''; if ( !empty( $item_animation ) ) { $animate_cls = ' pxl-animate pxl-invisible animated-'.$item_animation_duration; $data_animation = json_encode([ 'animation' => $item_animation, 'animation_delay' => (float)$item_animation_delay ]); $data_settings = 'data-settings="'.esc_attr($data_animation).'"'; } $flag = false; $post_format = get_post_format($post->ID) == false ? 'format-standard' : 'format-'.get_post_format($post->ID); ?> <div class="<?php echo esc_attr('list-item w-100 '. $post_format); ?> <?php echo esc_attr($animate_cls) ?>" <?php pxl_print_html($data_settings); ?>> <div class="grid-item-inner item-inner-wrap <?php echo esc_attr($post_format) ?>"> <?php if ( !empty( $thumbnail )){ ?> <div class="item-featured"> <div class="post-image scale-hover-x-left"> <?php echo wp_kses_post($thumbnail); ?> </div> </div> <?php } ?> <div class="item-content"> <h3 class="item-title"><a href="<?php echo esc_url(get_permalink( $post->ID )); ?>"><?php echo esc_html(get_the_title($post->ID)); ?></a></h3> <?php if($show_excerpt) : ?> <div class="item-excerpt"> <?php if(!empty($post->post_excerpt)){ echo wp_trim_words( $post->post_excerpt, $num_words, null ); } else{ $content = strip_shortcodes( $post->post_content ); $content = apply_filters( 'the_content', $content ); $content = str_replace(']]>', ']]>', $content); echo wp_trim_words( $content, $num_words, null ); } ?> </div> <?php endif; ?> <div class="item-post-metas"> <div class="meta-inner d-flex-wrap align-items-end"> <?php if($show_date) : ?> <span class="meta-item post-date col-auto d-flex"><span><?php echo get_the_date('d M Y', $post->ID); ?></span></span> <?php endif; ?> <?php if($show_author) : ?> <span class="meta-item post-author col-auto d-flex"><span><?php esc_html_e('By','plexify')?> <a href="<?php echo esc_url(get_author_posts_url($post->post_author, $author->user_nicename)); ?>"><?php echo esc_html($author->display_name); ?></a></span></span> <?php endif; ?> </div> <?php if($show_readmore) : ?> <a class="pxl-button-more" href="<?php echo esc_url( get_permalink($post->ID)); ?>"> <i class="pxli pxli-upper-right-arrow"></i> </a> <?php endif; ?> </div> </div> </div> </div> <?php endforeach; } function plexify_get_post_list_layout2($posts = [], $settings = []){ extract($settings); foreach ($posts as $key => $post): if (has_post_thumbnail($post->ID) && wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), false)){ $img_id = get_post_thumbnail_id($post->ID); if($img_id){ $img = pxl_get_image_by_size( array( 'attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => 'no-lazyload', )); $thumbnail = $img['thumbnail']; }else{ $thumbnail = get_the_post_thumbnail($post->ID, $img_size); } }else{ $thumbnail = ''; } $author = get_user_by('id', $post->post_author); $readmore_text = !empty($readmore_text) ? $readmore_text : esc_html__('Continue Reading', 'plexify'); $date_format = get_option('date_format'); $data_settings = ''; $animate_cls = ''; if ( !empty( $item_animation ) ) { $animate_cls = ' pxl-animate pxl-invisible animated-'.$item_animation_duration; $data_animation = json_encode([ 'animation' => $item_animation, 'animation_delay' => (float)$item_animation_delay ]); $data_settings = 'data-settings="'.esc_attr($data_animation).'"'; } $flag = false; $post_format = get_post_format($post->ID) == false ? 'format-standard' : 'format-'.get_post_format($post->ID); ?> <div class="<?php echo esc_attr('list-item w-100 '. $post_format); ?> <?php echo esc_attr($animate_cls) ?>" <?php pxl_print_html($data_settings); ?>> <div class="grid-item-inner item-inner-wrap row <?php echo esc_attr($post_format) ?>"> <?php $col_cls = ($flag = true) ? 'col-sm-6' : 'col'; ?> <div class="item-content <?php echo esc_attr($col_cls) ?>"> <div class="item-title-des"> <h3 class="item-title"><a href="<?php echo esc_url(get_permalink( $post->ID )); ?>"><?php echo esc_html(get_the_title($post->ID)); ?></a></h3> <?php if($show_excerpt) : ?> <div class="item-excerpt"> <?php if(!empty($post->post_excerpt)){ echo wp_trim_words( $post->post_excerpt, $num_words, null ); } else{ $content = strip_shortcodes( $post->post_content ); $content = apply_filters( 'the_content', $content ); $content = str_replace(']]>', ']]>', $content); echo wp_trim_words( $content, $num_words, null ); } ?> </div> <?php endif; ?> </div> <div class="item-post-metas"> <div class="meta-inner d-flex-wrap align-items-end"> <?php if($show_date) : ?> <span class="meta-item post-date col-auto d-flex"><span><?php echo get_the_date('d M Y', $post->ID); ?></span></span> <?php endif; ?> <?php if($show_author) : ?> <span class="meta-item post-author col-auto d-flex"><span><?php esc_html_e('By','plexify')?> <a href="<?php echo esc_url(get_author_posts_url($post->post_author, $author->user_nicename)); ?>"><?php echo esc_html($author->display_name); ?></a></span></span> <?php endif; ?> </div> </div> </div> <?php if ( !empty( $thumbnail )){ $flag = true; ?> <div class="item-featured col-sm-6"> <div class="post-image scale-hover-x"> <a href="<?php echo esc_url(get_permalink( $post->ID )); ?>"> <?php echo wp_kses_post($thumbnail); ?> </a> </div> </div> <?php }else{ $flag = true; } ?> </div> </div> <?php endforeach; } function plexify_get_services_list_layout1($posts = [], $settings = []){ extract($settings); foreach ($posts as $key => $post): if (has_post_thumbnail($post->ID) && wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), false)){ $img_id = get_post_thumbnail_id($post->ID); if($img_id){ $img = pxl_get_image_by_size( array( 'attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => 'no-lazyload', )); $thumbnail = $img['thumbnail']; }else{ $thumbnail = get_the_post_thumbnail($post->ID, $img_size); } }else{ $thumbnail = ''; } $author = get_user_by('id', $post->post_author); $date_format = get_option('date_format'); $data_settings = ''; $animate_cls = ''; if ( !empty( $item_animation ) ) { $animate_cls = ' pxl-animate pxl-invisible animated-'.$item_animation_duration; $data_animation = json_encode([ 'animation' => $item_animation, 'animation_delay' => (float)$item_animation_delay ]); $data_settings = 'data-settings="'.esc_attr($data_animation).'"'; } $flag = false; $post_format = get_post_format($post->ID) == false ? 'format-standard' : 'format-'.get_post_format($post->ID); ?> <div class="<?php echo esc_attr('list-item w-100 '. $post_format); ?> <?php echo esc_attr($animate_cls) ?>" <?php pxl_print_html($data_settings); ?>> <div class="grid-item-inner item-inner-wrap <?php echo esc_attr($post_format) ?>"> <?php if ( !empty( $thumbnail )){ ?> <div class="item-featured"> <div class="post-image scale-hover-x-left"> <?php echo wp_kses_post($thumbnail); ?> </div> </div> <?php } ?> <div class="item-content"> <div class="item-title-meta"> <h3 class="item-title"><a href="<?php echo esc_url(get_permalink( $post->ID )); ?>"><?php echo esc_html(get_the_title($post->ID)); ?></a></h3> <div class="meta-inner d-flex-wrap align-items-end"> <?php if($show_date) : ?> <span class="meta-item post-date col-auto d-flex"><span class="text-item"><?php echo esc_html('Design -', 'plexify'); ?></span> <span><?php echo get_the_date('Y', $post->ID); ?></span></span> <?php endif; ?> </div> </div> <?php if($show_readmore) : ?> <a class="pxl-button-more" href="<?php echo esc_url( get_permalink($post->ID)); ?>"> <i class="pxli pxli-arrow-right1"></i> </a> <?php endif; ?> </div> </div> </div> <?php endforeach; } function plexify_get_services_list_layout2($posts = [], $settings = []){ extract($settings); $number = 1; foreach ($posts as $key => $post): $author = get_user_by('id', $post->post_author); $date_format = get_option('date_format'); $data_settings = ''; $animate_cls = ''; if ( !empty( $item_animation ) ) { $animate_cls = ' pxl-animate pxl-invisible animated-'.$item_animation_duration; $data_animation = json_encode([ 'animation' => $item_animation, 'animation_delay' => (float)$item_animation_delay ]); $data_settings = 'data-settings="'.esc_attr($data_animation).'"'; } $flag = false; $post_format = get_post_format($post->ID) == false ? 'format-standard' : 'format-'.get_post_format($post->ID); $service_icon = get_post_meta( $post->ID, 'service_icon', true ); ?> <div class="<?php echo esc_attr('list-item w-100 '. $post_format); ?> <?php echo esc_attr($animate_cls) ?>" <?php pxl_print_html($data_settings); ?>> <div class="grid-item-inner item-inner-wrap <?php echo esc_attr($post_format) ?>"> <div class="item-content"> <?php if (!empty($service_icon['url'])): if (strpos($service_icon['url'], '.svg') !== false): $svg_content = file_get_contents($service_icon['url']) ? file_get_contents($service_icon['url']) : ''; if ($svg_content): ?> <span class="service-icon"><?php pxl_print_html($svg_content) ?></span> <?php endif; else: ?> <span class="service-icon"><img src="<?php echo esc_url($service_icon['url']); ?>" alt="Service Icon"></span> <?php endif; endif;?> <div class="content-item"> <div class="item-title-meta"> <h3 class="item-title"><a href="<?php echo esc_url(get_permalink( $post->ID )); ?>"><?php echo esc_html(get_the_title($post->ID)); ?></a></h3> </div> <?php if($show_excerpt) : ?> <div class="item-excerpt"> <?php if(!empty($post->post_excerpt)){ echo wp_trim_words( $post->post_excerpt, $num_words, null ); } else{ $content = strip_shortcodes( $post->post_content ); $content = apply_filters( 'the_content', $content ); $content = str_replace(']]>', ']]>', $content); echo wp_trim_words( $content, $num_words, null ); } ?> </div> <?php endif; ?> </div> </div> <div class="item-category"> <span class="item-number"><?php echo esc_html(sprintf('%02d', $number)); ?></span> <?php if( $show_category): ?> <span class="service-category col-auto d-flex"><?php the_terms( $post->ID, 'services-category', '', ' ', '' ); ?></span> <?php endif; ?> </div> </div> </div> <?php $number++; endforeach; }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
assets
---
0755
register
---
0755
templates
---
0755
element-custom.php
35310 bytes
0644
element-functions.php
83396 bytes
0644
element-templates.php
31721 bytes
0644
N4ST4R_ID | Naxtarrr