Loading...
cted Input public function render_password_protected_input( $settings ) { if ( ! post_password_required() ) { return; } add_filter( 'the_password_form', function () { $output = '
'; $output .= ''; $output .= '

'. esc_html(get_the_title()) .'

'; $output .= ''; $output .= '
'; return $output; } ); echo '
'; echo '
'; echo '
'; echo get_the_password_form(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '
'; echo '
'; echo '
'; } // Render Post Thumbnail public function render_post_thumbnail( $settings ) { $id = get_post_thumbnail_id(); $src = Group_Control_Image_Size::get_attachment_image_src( $id, 'layout_image_crop', $settings ); $alt = '' === wp_get_attachment_caption( $id ) ? get_the_title() : wp_get_attachment_caption( $id ); if ( has_post_thumbnail() ) { echo '
'; } } // Render Media Overlay public function render_media_overlay( $settings ) { echo '
'; if ( wpr_fs()->can_use_premium_code() ) { if ( '' !== $settings['overlay_image']['url'] ) { echo ''; } } echo '
'; } // Render Post Title public function render_post_title( $settings, $class ) { $title_pointer = ! wpr_fs()->can_use_premium_code() ? 'none' : $this->get_settings()['title_pointer']; $title_pointer_animation = ! wpr_fs()->can_use_premium_code() ? 'fade' : $this->get_settings()['title_pointer_animation']; $pointer_item_class = (isset($this->get_settings()['title_pointer']) && 'none' !== $this->get_settings()['title_pointer']) ? 'class="wpr-pointer-item"' : ''; $open_links_in_new_tab = 'yes' === $this->get_settings()['open_links_in_new_tab'] ? '_blank' : '_self'; $class .= ' wpr-pointer-'. $title_pointer; $class .= ' wpr-pointer-line-fx wpr-pointer-fx-'. $title_pointer_animation; $tags_whitelist = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p']; $element_title_tag = Utilities::validate_html_tags_wl( $settings['element_title_tag'], 'h2', $tags_whitelist ); echo '<'. esc_html($element_title_tag) .' class="'. esc_attr($class) .'">'; echo '
'; echo ''; if ( 'word_count' === $settings['element_trim_text_by'] ) { echo esc_html(wp_trim_words( get_the_title(), $settings['element_word_count'] )); } else { echo substr(html_entity_decode(get_the_title()), 0, $settings['element_letter_count']) . '...'; } echo ''; echo '
'; echo ''; } // Render Post Content public function render_post_content( $settings, $class ) { $dropcap_class = 'yes' === $settings['element_dropcap'] ? ' wpr-enable-dropcap' : ''; $class .= $dropcap_class; if ( '' === get_the_content() ) { return; } echo '
'; echo '
'; echo wp_kses_post(get_the_content()); echo '
'; echo '
'; } // Render Post Excerpt public function render_post_excerpt( $settings, $class ) { $dropcap_class = 'yes' === $settings['element_dropcap'] ? ' wpr-enable-dropcap' : ''; $class .= $dropcap_class; if ( '' === get_the_excerpt() ) { return; } echo '
'; echo '
'; if ( 'word_count' === $settings['element_trim_text_by']) { echo '

'. esc_html(wp_trim_words( get_the_excerpt(), $settings['element_word_count'] )) .'

'; } else { // echo '

'. substr(html_entity_decode(get_the_title()), 0, $settings['element_letter_count']) .'...' . '

'; echo '

'. esc_html(implode('', array_slice( str_split(get_the_excerpt()), 0, $settings['element_letter_count'] ))) .'...' .'

'; } echo '
'; echo '
'; } // Render Post Date public function render_post_date( $settings, $class ) { echo '
'; echo '
'; echo ''; // Text: Before if ( 'before' === $settings['element_extra_text_pos'] ) { echo ''. esc_html( $settings['element_extra_text'] ) .''; } // Icon: Before if ( 'before' === $settings['element_extra_icon_pos'] ) { ob_start(); \Elementor\Icons_Manager::render_icon($settings['element_extra_icon'], ['aria-hidden' => 'true']); $extra_icon = ob_get_clean(); echo ''; echo $extra_icon; echo ''; } // Date if ( 'yes' === $settings['show_last_update_date'] ) { echo esc_html(get_the_modified_time(get_option( 'date_format' ))); } else { echo esc_html(apply_filters( 'the_date', get_the_date( '' ), get_option( 'date_format' ), '', '' )); } // Icon: After if ( 'after' === $settings['element_extra_icon_pos'] ) { ob_start(); \Elementor\Icons_Manager::render_icon($settings['element_extra_icon'], ['aria-hidden' => 'true']); $extra_icon = ob_get_clean(); echo ''; echo $extra_icon; echo ''; } // Text: After if ( 'after' === $settings['element_extra_text_pos'] ) { echo ''. esc_html( $settings['element_extra_text'] ) .''; } echo ''; echo '
'; echo '
'; } // Render Post Time public function render_post_time( $settings, $class ) { echo '
'; echo '
'; echo ''; // Text: Before if ( 'before' === $settings['element_extra_text_pos'] ) { echo ''. esc_html( $settings['element_extra_text'] ) .''; } // Icon: Before if ( 'before' === $settings['element_extra_icon_pos'] ) { ob_start(); \Elementor\Icons_Manager::render_icon($settings['element_extra_icon'], ['aria-hidden' => 'true']); $extra_icon = ob_get_clean(); echo ''; echo $extra_icon; echo ''; } // Time echo esc_html(get_the_time( '' )); // Icon: After if ( 'after' === $settings['element_extra_icon_pos'] ) { ob_start(); \Elementor\Icons_Manager::render_icon($settings['element_extra_icon'], ['aria-hidden' => 'true']); $extra_icon = ob_get_clean(); echo ''; echo $extra_icon; echo ''; } // Text: After if ( 'after' === $settings['element_extra_text_pos'] ) { echo ''. esc_html( $settings['element_extra_text'] ) .''; } echo ''; echo '
'; echo '
'; } // Render Post Author public function render_post_author( $settings, $class ) { $author_id = get_post_field( 'post_author' ); echo '
'; echo ''; echo '
'; } // Render Post Comments public function render_post_comments( $settings, $class ) { $count = get_comments_number(); if ( comments_open() ) { if ( $count == 1 ) { $text = $count .' '. $settings['element_comments_text_2']; } elseif ( $count > 1 ) { $text = $count .' '. $settings['element_comments_text_3']; } else { $text = $settings['element_comments_text_1']; } echo '
'; echo ''; echo '
'; } } // Render Post Read More public function render_post_read_more( $settings, $class ) { $read_more_animation = ! wpr_fs()->can_use_premium_code() ? 'wpr-button-none' : $this->get_settings()['read_more_animation']; $open_links_in_new_tab = 'yes' === $this->get_settings()['open_links_in_new_tab'] ? '_blank' : '_self'; echo '
'; echo ''; echo '
'; } // Render Post Likes public function render_post_likes( $settings, $class, $post_id ) {} // Render Post Sharing public function render_post_sharing_icons( $settings, $class ) {} // Render Post Custom Field public function render_post_custom_field( $settings, $class, $post_id ) {} // Render Post Element Separator public function render_post_element_separator( $settings, $class ) { echo '
'; echo '
'; echo '
'; } // Render Post Taxonomies public function render_post_taxonomies( $settings, $class, $post_id ) { $terms = wp_get_post_terms( $post_id, $settings['element_select'] ); $count = 0; $tax1_pointer = ! wpr_fs()->can_use_premium_code() ? 'none' : $this->get_settings()['tax1_pointer']; $tax1_pointer_animation = ! wpr_fs()->can_use_premium_code() ? 'fade' : $this->get_settings()['tax1_pointer_animation']; $tax2_pointer = ! wpr_fs()->can_use_premium_code() ? 'none' : $this->get_settings()['tax2_pointer']; $tax2_pointer_animation = ! wpr_fs()->can_use_premium_code() ? 'fade' : $this->get_settings()['tax2_pointer_animation']; $pointer_item_class = (isset($this->get_settings()['tax1_pointer']) && 'none' !== $this->get_settings()['tax1_pointer']) || (isset($this->get_settings()['tax2_pointer']) && 'none' !== $this->get_settings()['tax2_pointer']) ? 'wpr-pointer-item' : ''; // Pointer Class if ( 'wpr-grid-tax-style-1' === $settings['element_tax_style'] ) { $class .= ' wpr-pointer-'. $tax1_pointer; $class .= ' wpr-pointer-line-fx wpr-pointer-fx-'. $tax1_pointer_animation; } else { $class .= ' wpr-pointer-'. $tax2_pointer; $class .= ' wpr-pointer-line-fx wpr-pointer-fx-'. $tax2_pointer_animation; } echo '
'; echo '
'; // Text: Before if ( 'before' === $settings['element_extra_text_pos'] ) { echo ''. esc_html( $settings['element_extra_text'] ) .''; } // Icon: Before if ( 'before' === $settings['element_extra_icon_pos'] ) { ob_start(); \Elementor\Icons_Manager::render_icon($settings['element_extra_icon'], ['aria-hidden' => 'true']); $extra_icon = ob_get_clean(); echo ''; echo $extra_icon; echo ''; } // Taxonomies foreach ( $terms as $term ) { // Custom Colors $enable_custom_colors = ! wpr_fs()->can_use_premium_code() ? '' : $this->get_settings()['tax1_custom_color_switcher']; if ( 'yes' === $enable_custom_colors ) { $custom_tax_styles = ''; $cfc_text = get_term_meta($term->term_id, $this->get_settings()['tax1_custom_color_field_text'], true); $cfc_bg = get_term_meta($term->term_id, $this->get_settings()['tax1_custom_color_field_bg'], true); $color_styles = 'color:'. $cfc_text .'; background-color:'. $cfc_bg .'; border-color:'. $cfc_bg .';'; $css_selector = '.elementor-element'. $this->get_unique_selector() .' .wpr-grid-tax-style-1 .inner-block a.wpr-tax-id-'. esc_attr($term->term_id); $custom_tax_styles .= $css_selector .'{'. $color_styles .'}'; echo ''; // TODO: take out of loop if possible } echo ''. esc_html( $term->name ); if ( ++$count !== count( $terms ) ) { echo ''. esc_html($settings['element_tax_sep']) .''; } echo ''; } // Icon: After if ( 'after' === $settings['element_extra_icon_pos'] ) { ob_start(); \Elementor\Icons_Manager::render_icon($settings['element_extra_icon'], ['aria-hidden' => 'true']); $extra_icon = ob_get_clean(); echo ''; echo $extra_icon; echo ''; } // Text: After if ( 'after' === $settings['element_extra_text_pos'] ) { echo ''. esc_html( $settings['element_extra_text'] ) .''; } echo '
'; echo '
'; } // Get Elements public function get_elements( $type, $settings, $class, $post_id ) { if ( 'pro-lk' == $type || 'pro-shr' == $type || 'pro-cf' == $type ) { $type = 'title'; } switch ( $type ) { case 'title': $this->render_post_title( $settings, $class ); break; case 'content': $this->render_post_content( $settings, $class ); break; case 'excerpt': $this->render_post_excerpt( $settings, $class ); break; case 'date': $this->render_post_date( $settings, $class ); break; case 'time': $this->render_post_time( $settings, $class ); break; case 'author': $this->render_post_author( $settings, $class ); break; case 'comments': $this->render_post_comments( $settings, $class ); break; case 'read-more': $this->render_post_read_more( $settings, $class ); break; case 'likes': $this->render_post_likes( $settings, $class, $post_id ); break; case 'sharing': $this->render_post_sharing_icons( $settings, $class ); break; case 'custom-field': $this->render_post_custom_field( $settings, $class, $post_id ); break; case 'separator': $this->render_post_element_separator( $settings, $class ); break; default: $this->render_post_taxonomies( $settings, $class, $post_id ); break; } } // Get Elements by Location public function get_elements_by_location( $location, $settings, $post_id ) { $locations = []; foreach ( $settings['grid_elements'] as $data ) { $place = 'over'; $align_vr = $data['element_align_vr']; if ( ! wpr_fs()->can_use_premium_code() ) { $align_vr = 'bottom'; } if ( ! isset($locations[$place]) ) { $locations[$place] = []; } if ( 'over' === $place ) { if ( ! isset($locations[$place][$align_vr]) ) { $locations[$place][$align_vr] = []; } array_push( $locations[$place][$align_vr], $data ); } else { array_push( $locations[$place], $data ); } } if ( ! empty( $locations[$location] ) ) { if ( 'over' === $location ) { foreach ( $locations[$location] as $align => $elements ) { if ( 'middle' === $align ) { echo '
'; } echo '
'; foreach ( $elements as $data ) { // Get Class $class = 'wpr-grid-item-'. $data['element_select']; $class .= ' elementor-repeater-item-'. $data['_id']; $class .= ' wpr-grid-item-display-'. $data['element_display']; $class .= ' wpr-grid-item-align-'. $data['element_align_hr']; $class .= $this->get_animation_class( $data, 'element' ); // Element $this->get_elements( $data['element_select'], $data, $class, $post_id ); } echo '
'; if ( 'middle' === $align ) { echo '
'; } } } else { echo '
'; foreach ( $locations[$location] as $data ) { // Get Class $class = 'wpr-grid-item-'. $data['element_select']; $class .= ' elementor-repeater-item-'. $data['_id']; $class .= ' wpr-grid-item-display-'. $data['element_display']; $class .= ' wpr-grid-item-align-'. $data['element_align_hr']; // Element $this->get_elements( $data['element_select'], $data, $class, $post_id ); } echo '
'; } } } public function add_slider_settings( $settings ) { $slider_is_rtl = is_rtl(); $slider_direction = $slider_is_rtl ? 'rtl' : 'ltr'; $slider_options = [ 'rtl' => $slider_is_rtl, 'slidesToShow' => 1, 'infinite' => ( $settings['slider_loop'] === 'yes' ), 'speed' => absint( $settings['slider_effect_duration'] * 1000 ), 'arrows' => true, 'autoplay' => ( $settings['slider_autoplay'] === 'yes' ), 'autoplaySpeed' => absint( $settings['slider_autoplay_duration'] * 1000 ), 'pauseOnHover' => $settings['slider_pause_on_hover'], 'prevArrow' => '#wpr-grid-slider-prev-'. $this->get_id(), 'nextArrow' => '#wpr-grid-slider-next-'. $this->get_id(), ]; $this->add_render_attribute( 'slider-settings', [ 'dir' => esc_attr( $slider_direction ), 'data-slick' => wp_json_encode( $slider_options ), ] ); } public function render_magazine_grid( $settings, $slide_offset ) { // Get Posts $posts = new \WP_Query( $this->get_main_query_args( $slide_offset ) ); if ( ! wpr_fs()->can_use_premium_code() ) { if ( '1-2' === $settings['layout_select'] || '1-3' === $settings['layout_select'] || '1-4' === $settings['layout_select'] || '1-1-2' === $settings['layout_select'] || '2-1-2' === $settings['layout_select'] || '1vh-3h' === $settings['layout_select'] ) { $settings['layout_select'] = '1-1-3'; } } echo '
'; // Loop: Start if ( $posts->have_posts() ) : while ( $posts->have_posts() ) : $posts->the_post(); // Post Class $post_class = implode( ' ', get_post_class( 'wpr-mgzn-grid-item elementor-clearfix', get_the_ID() ) ); // Grid Item echo '
'; // Password Protected Form $this->render_password_protected_input( $settings ); // Inner Wrapper echo '
'; // Media echo '
'; // Post Thumbnail $this->render_post_thumbnail( $settings, get_the_ID() ); // Media Hover echo '
'; // Media Overlay $this->render_media_overlay( $settings ); // Content: Over Media $this->get_elements_by_location( 'over', $settings, get_the_ID() ); echo '
'; echo '
'; echo '
'; // End .wpr-grid-item-inner echo '
'; // End .wpr-grid-item endwhile; // reset wp_reset_postdata(); // No Posts Found else: echo '

'. esc_html($settings['query_not_found_text']) .'

'; // Loop: End endif; // Grid Wrap echo '
'; } protected function render() { // Get Settings $settings = $this->get_settings(); $render_attribute = ''; if ( ! wpr_fs()->can_use_premium_code() ) { $settings['slider_enable'] = ''; $settings['slider_effect'] = ''; } // Slider Settings if ( 'yes' === $settings['slider_enable'] ) { $this->add_slider_settings( $settings ); $render_attribute = $this->get_render_attribute_string( 'slider-settings' ); } // Grid/Slider Wrap echo '
'; // Slider if ( 'yes' === $settings['slider_enable'] ) { for ( $i=0; $i < $settings['slider_amount']; $i++ ) { echo '
'; $this->render_magazine_grid( $settings, $i ); echo '
'; } // Grid } else { $this->render_magazine_grid( $settings, 0 ); } // Grid/Slider Wrap echo '
'; // Slider Navigation if ( 'yes' === $settings['slider_enable'] ) { echo '
'; echo '
'. Utilities::get_wpr_icon( $settings['slider_nav_icon'], '' ) .'
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '
'. Utilities::get_wpr_icon( $settings['slider_nav_icon'], '' ) .'
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '
'; } } }