ransform: translate(50%,-50%) !important;',
],
'condition' => [
'timeline_layout' => ['one-sided', 'one-sided-left']
],
'render_type' => 'template',
]
);
$this->add_control(
'arrow_bothsided_position_top',
[
'label' => __( 'Position Top', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ '%', 'px' ],
'range' => [
'%' => [
'min' => 0,
'max' => 100,
],
'px' => [
'min' => 0,
'max' => 150,
],
],
'default' => [
'size' => 30,
'unit' => '%',
],
'selectors' => [
'{{WRAPPER}} .wpr-timeline-centered .wpr-data-wrap:after' => 'top: {{size}}{{UNIT}}; transform: translateY(-50%) !important;',
'{{WRAPPER}} .wpr-timeline-centered.wpr-both-sided-timeline .wpr-right-aligned .wpr-icon' => 'position: absolute; top: {{size}}{{UNIT}}; transform: translate(50%, -50%) !important;',
'{{WRAPPER}} .wpr-timeline-centered.wpr-one-sided-timeline .wpr-right-aligned .wpr-icon' => 'position: absolute; top: {{size}}{{UNIT}}; transform: translate(-50%, -50%) !important;',
'{{WRAPPER}} .wpr-timeline-centered .wpr-left-aligned .wpr-icon' => 'position: absolute; top: {{size}}{{UNIT}}; transform: translate(-50%, -50%) !important;',
'{{WRAPPER}} .wpr-timeline-centered .wpr-extra-label' => 'top: {{size}}{{UNIT}};',
'{{WRAPPER}} .wpr-centered .wpr-one-sided-timeline .wpr-data-wrap:after' => 'top: {{size}}{{UNIT}}; transform: translateY(-50%) !important;',
],
'condition' => [
'timeline_layout' => ['centered']
],
'render_type' => 'template'
]
);
$this->end_controls_section();
$this->start_controls_section(
'navigation_button_styles',
[
'label' => esc_html__( 'Navigation', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'timeline_layout' => ['horizontal', 'horizontal-bottom']
]
]
);
$this->start_controls_tabs(
'navigation_style_tabs'
);
$this->start_controls_tab(
'navigation_style_normal_tab',
[
'label' => __( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'navigation_button_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .wpr-button-prev' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-button-next' => 'background-color: {{VALUE}}',
],
'condition' => [
'timeline_layout' => ['horizontal', 'horizontal-bottom']
]
]
);
$this->add_control(
'navigation_button_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-button-prev i' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-button-next i' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-button-prev svg' => 'fill: {{VALUE}}; cursor: pointer; z-index: 11;',
'{{WRAPPER}} .wpr-button-next svg' => 'fill: {{VALUE}}; cursor: pointer; z-index: 11;',
],
'condition' => [
'timeline_layout' => ['horizontal', 'horizontal-bottom']
]
]
);
$this->add_control(
'navigation_transition_duration',
[
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.1,
'min' => 0,
'max' => 5,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-button-prev' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-button-next' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-button-prev i' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-button-next i' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-button-prev svg' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-button-next svg' => 'transition-duration: {{VALUE}}s',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'navigation_icon_size',
[
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 10,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 40,
],
'selectors' => [
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-next' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-prev' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-next' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-prev' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-next svg' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-prev svg' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-next svg' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-prev svg' => 'width: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'navigation_icon_bg_size',
[
'label' => esc_html__( 'Box Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 20,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 40,
],
'selectors' => [
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-next' => 'width: {{SIZE}}{{UNIT}}; text-align: center; height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-prev' => 'width: {{SIZE}}{{UNIT}}; text-align: center; height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-next' => 'width: {{SIZE}}{{UNIT}}; text-align: center; height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-prev' => 'width: {{SIZE}}{{UNIT}}; text-align: center; height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-next i' => 'width: {{SIZE}}{{UNIT}}; text-align: center; line-height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-prev i' => 'width: {{SIZE}}{{UNIT}}; text-align: center; line-height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal .wpr-button-next svg' => ' text-align: center; line-height: 1.5;',
'{{WRAPPER}} .wpr-horizontal .wpr-button-prev svg' => ' text-align: center; line-height: 1.5;',
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-next i' => 'width: {{SIZE}}{{UNIT}}; text-align: center; line-height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-prev i' => 'width: {{SIZE}}{{UNIT}}; text-align: center; line-height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-next svg' => 'text-align: center; line-height: 1.5;',
'{{WRAPPER}} .wpr-horizontal-bottom .wpr-button-prev svg' => 'text-align: center; line-height: 1.5;',
'{{WRAPPER}} .wpr-swiper-pagination.swiper-pagination-progressbar' => 'width: calc(100% - ({{SIZE}}px + 15px)*2);',
'{{WRAPPER}} .wpr-horizontal-bottom.swiper-container' => 'margin-left: {{SIZE}}px; margin-right: {{SIZE}}px;',
'{{WRAPPER}} .wpr-horizontal.swiper-container' => 'margin-left: {{SIZE}}px; margin-right: {{SIZE}}px;',
],
'render_type' => 'template'
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'navigation_style_hover_tab',
[
'label' => __( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'navigation_button_bg_color_hover',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .wpr-button-prev:hover' => 'background-color: {{VALUE}}; cursor: pointer;',
'{{WRAPPER}} .wpr-button-next:hover' => 'background-color: {{VALUE}}; cursor: pointer;',
],
'condition' => [
'timeline_layout' => ['horizontal', 'horizontal-bottom']
]
]
);
$this->add_control(
'navigation_button_color_hover',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE1',
'selectors' => [
'{{WRAPPER}} .wpr-button-prev:hover i' => 'color: {{VALUE}}; cursor: pointer; z-index: 11;',
'{{WRAPPER}} .wpr-button-next:hover i' => 'color: {{VALUE}}; cursor: pointer; z-index: 11;',
'{{WRAPPER}} .wpr-button-prev:hover svg' => 'fill: {{VALUE}}; cursor: pointer; z-index: 11;',
'{{WRAPPER}} .wpr-button-next:hover svg' => 'fill: {{VALUE}}; cursor: pointer; z-index: 11;',
],
'condition' => [
'timeline_layout' => ['horizontal', 'horizontal-bottom']
]
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
// Styles ====================
// Section: Pagination -------
$this->start_controls_section(
'section_style_pagination',
[
'label' => esc_html__( 'Pagination', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
'condition' => [
'timeline_content' => 'dynamic',
'timeline_layout' => ['centered', 'one-sided', 'one-sided-left']
],
]
);
$this->start_controls_tabs( 'tabs_grid_pagination_style' );
$this->start_controls_tab(
'tab_grid_pagination_normal',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'pagination_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination svg' => 'fill: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination > div > span' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-disabled-arrow' => 'color: {{VALUE}}',
],
'condition' => [
'timeline_layout' => ['centered', 'one-sided', 'one-sided-left']
]
]
);
$this->add_control(
'pagination_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination > div > span' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-disabled-arrow' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-pagination-finish' => 'color: {{VALUE}}',
]
]
);
$this->add_control(
'pagination_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination > div > span' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-disabled-arrow' => 'border-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'pagination_box_shadow',
'selector' => '{{WRAPPER}} .wpr-grid-pagination a, {{WRAPPER}} .wpr-grid-pagination > div > span',
]
);
$this->add_control(
'pagination_loader_color',
[
'label' => esc_html__( 'Loader Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-double-bounce .wpr-child' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-wave .wpr-rect' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-spinner-pulse' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-chasing-dots .wpr-child' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-three-bounce .wpr-child' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-fading-circle .wpr-circle:before' => 'background-color: {{VALUE}}',
],
'condition' => [
'pagination_type' => [ 'load-more', 'infinite-scroll' ]
]
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_grid_pagination_hover',
[
'label' => esc_html__( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'pagination_color_hr',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a:hover' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination a:hover svg' => 'fill: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination > div > span:not(.wpr-disabled-arrow):hover' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-grid-current-page' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'pagination_bg_color_hr',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#4A45D2',
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a:hover' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination > div > span:not(.wpr-disabled-arrow):hover' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-grid-current-page' => 'background-color: {{VALUE}}',
]
]
);
$this->add_control(
'pagination_border_color_hr',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a:hover' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination > div > span:not(.wpr-disabled-arrow):hover' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-grid-current-page' => 'border-color: {{VALUE}}',
]
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'pagination_box_shadow_hr',
'selector' => '{{WRAPPER}} .wpr-grid-pagination a:hover, {{WRAPPER}} .wpr-grid-pagination > div > span:not(.wpr-disabled-arrow):hover',
'separator' => 'after',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control(
'pagination_transition_duration',
[
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.1,
'min' => 0,
'max' => 5,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-grid-pagination svg' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-grid-pagination > div > span' => 'transition-duration: {{VALUE}}s',
],
'separator' => 'after',
]
);
;$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'loadmore_typography',
'label' => __( 'Typography', 'wpr-addons' ),
'selector' => '{{WRAPPER}} .wpr-load-more-btn',
]
);
$this->add_control(
'pagination_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a' => 'border-style: {{VALUE}};',
'{{WRAPPER}} .wpr-grid-pagination > div > span' => 'border-style: {{VALUE}};',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-grid-current-page' => 'border-style: {{VALUE}};',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-disabled-arrow' => 'border-style: {{VALUE}}',
],
'separator' => 'before',
]
);
$this->add_control(
'pagination_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-grid-pagination > div > span' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-grid-current-page' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-disabled-arrow' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'pagination_border_type!' => 'none',
],
]
);
$this->add_responsive_control(
'pagination_distance_from_grid',
[
'label' => esc_html__( 'Distance From Timeline', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 25,
],
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination' => 'margin-top: {{SIZE}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'pagination_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 8,
'right' => 20,
'bottom' => 8,
'left' => 20,
],
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-grid-pagination > div > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-disabled-arrow' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-grid-current-page' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'pagination_wrapper_padding',
[
'label' => esc_html__( 'Wrapper Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'pagination_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
],
'selectors' => [
'{{WRAPPER}} .wpr-grid-pagination a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-grid-pagination > div > span' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-grid-pagination span.wpr-grid-current-page' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->end_controls_section();
}
public function get_tax_query_args() {
$settings = $this->get_settings();
$tax_query = [];
if ( 'related' === $settings[ 'timeline_post_types' ] ) {
$tax_query = [
[
'taxonomy' => $settings['query_tax_selection'],
'field' => 'term_id',
'terms' => wp_get_object_terms( get_the_ID(), $settings['query_tax_selection'], array( 'fields' => 'ids' ) ),
]
];
} else {
foreach ( get_object_taxonomies($settings[ 'timeline_post_types' ]) as $tax ) {
if ( ! empty($settings[ 'query_taxonomy_'. $tax ]) ) {
array_push( $tax_query, [
'taxonomy' => $tax,
'field' => 'id',
'terms' => $settings[ 'query_taxonomy_'. $tax ]
] );
}
}
}
return $tax_query;
}
// for frontend
public function get_main_query_args() {
$settings = $this->get_settings();
$author = ! empty( $settings[ 'query_author' ] ) ? implode( ',', $settings[ 'query_author' ] ) : '';
// Get Paged
if ( get_query_var( 'paged' ) ) {
$paged = get_query_var( 'paged' );
} elseif ( get_query_var( 'page' ) ) {
$paged = get_query_var( 'page' );
} else {
$paged = 1;
}
$posts_per_page = (!wpr_fs()->can_use_premium_code() && $settings['posts_per_page'] > 4) ? 4 : (empty($settings['posts_per_page']) ? 4 : $settings['posts_per_page']);
// Dynamic
$args = [
'post_type' => $settings[ 'timeline_post_types' ],
'tax_query' => $this->get_tax_query_args(),
'post__not_in' => !empty($settings[ 'query_exclude_'. $settings[ 'timeline_post_types' ] ]) ? $settings[ 'query_exclude_'. $settings[ 'timeline_post_types' ] ] : '',
'posts_per_page' => $posts_per_page,
'orderby' => $settings[ 'order_posts' ],
'order' => $settings['order_direction'],
'author' => $author,
'paged' => $paged,
];
// Exclude Items without F/Image
if ( 'yes' === $settings['query_exclude_no_images'] ) {
$args['meta_key'] = '_thumbnail_id';
}
// Manual
if ( 'manual' === $settings[ 'query_selection' ] ) {
$post_ids = [''];
if ( ! empty($settings[ 'query_manual_'. $settings[ 'timeline_post_types' ] ]) ) {
$post_ids = $settings[ 'query_manual_'. $settings[ 'timeline_post_types' ] ];
}
$args = [
'post_type' => $settings[ 'timeline_post_types' ],
'post__in' => $post_ids,
'posts_per_page' => $posts_per_page,
'orderby' => '', // $settings[ 'query_randomize' ],
'paged' => $paged,
];
}
return $args;
}
public function get_max_num_pages( $settings ) {
$query = new \WP_Query( $this->get_main_query_args() );
$max_num_pages = intval( ceil( $query->max_num_pages ) );
// Reset
wp_reset_postdata();
// $max_num_pages
return $max_num_pages;
}
public $content_alignment = '';
public function content_and_animation_alignment($layout, $countItem, $settings) {
if ( $layout != 'one-sided-left' ) {
$this->content_alignment = "wpr-right-aligned";
}
if ( $layout === 'one-sided-left' ) {
$this->content_alignment = "wpr-left-aligned";
}
if ( $layout == 'centered' ) {
if ( $countItem % 2 == 0 ) {
$this->content_alignment = "wpr-left-aligned";
}
if ( preg_match('/right/i', $settings['timeline_animation']) ) {
if ( 'wpr-left-aligned' === $this->content_alignment ) {
$this->animation = preg_match('/right/i', $settings['timeline_animation']) ? str_replace('right', 'left', $settings['timeline_animation']) : $settings['timeline_animation'];
} elseif ( 'wpr-right-aligned' === $this->content_alignment ) {
$this->animation = preg_match('/left/i', $settings['timeline_animation']) ? str_replace('left', 'right', $settings['timeline_animation']) : $settings['timeline_animation'];
}
}
if ( preg_match('/left/i', $settings['timeline_animation']) ) {
if ( 'wpr-left-aligned' === $this->content_alignment ) {
$this->animation = preg_match('/left/i', $settings['timeline_animation']) ? str_replace('left', 'right', $settings['timeline_animation']) : $settings['timeline_animation'];
} elseif ( 'wpr-right-aligned' === $this->content_alignment ) {
$this->animation = preg_match('/right/i', $settings['timeline_animation']) ? str_replace('right', 'left', $settings['timeline_animation']) : $settings['timeline_animation'];
}
}
}
if ( preg_match('/right/i', $settings['timeline_animation']) ) {
$this->animation_loadmore_left = preg_match('/right/i', $settings['timeline_animation']) ? str_replace('right', 'left', $settings['timeline_animation']) : $settings['timeline_animation'];
$this->animation_loadmore_right = preg_match('/left/i', $settings['timeline_animation']) ? str_replace('left', 'right', $settings['timeline_animation']) : $settings['timeline_animation'];
} elseif ( preg_match('/left/i', $settings['timeline_animation']) ) {
$this->animation_loadmore_left = preg_match('/left/i', $settings['timeline_animation']) ? str_replace('left', 'right', $settings['timeline_animation']) : $settings['timeline_animation'];
$this->animation_loadmore_right = preg_match('/right/i', $settings['timeline_animation']) ? str_replace('right', 'left', $settings['timeline_animation']) : $settings['timeline_animation'];
}
}
public function add_custom_horizontal_timeline_attributes($content, $settings, $index) {
$this->timeline_description = $content['repeater_description'];
$this->story_date_label = esc_html__($content['repeater_date_label']);
$this->story_extra_label = esc_html__($content['repeater_extra_label']);
$this->timeline_story_title = wp_kses_post($content['repeater_story_title']);
$this->thumbnail_size = $content['wpr_thumbnail_size'];
$this->thumbnail_custom_dimension = $content['wpr_thumbnail_custom_dimension'];
$this->show_year_label = esc_html__($content['repeater_show_year_label']);
$this->timeline_year = esc_html__($content['repeater_year']);
$this->title_key = $this->get_repeater_setting_key( 'repeater_story_title', 'timeline_repeater_list', $index );
$this->year_key = $this->get_repeater_setting_key( 'repeater_year', 'timeline_repeater_list', $index );
$this->date_label_key = $this->get_repeater_setting_key( 'repeater_date_label', 'timeline_repeater_list', $index );
$this->extra_label_key = $this->get_repeater_setting_key( 'repeater_extra_label', 'timeline_repeater_list', $index );
$this->description_key = $this->get_repeater_setting_key( 'repeater_description', 'timeline_repeater_list', $index );
$this->background_image = $settings['content_layout'] === 'background' ? $content['repeater_image']['url'] : '';
$this->background_class = $settings['content_layout'] === 'background' ? 'story-with-background' : '';
$this->add_inline_editing_attributes( $this->title_key, 'none' );
$this->add_inline_editing_attributes( $this->year_key, 'none' );
$this->add_inline_editing_attributes( $this->date_label_key, 'none' );
$this->add_inline_editing_attributes( $this->extra_label_key, 'none' );
$this->add_inline_editing_attributes( $this->description_key, 'advanced' );
$this->add_render_attribute( $this->title_key, ['class'=> 'wpr-title']);
$this->add_render_attribute( $this->year_key, ['class'=> 'wpr-year-label wpr-year']);
$this->add_render_attribute( $this->date_label_key, ['class'=> 'wpr-label']);
$this->add_render_attribute( $this->extra_label_key, ['class'=> 'wpr-sub-label']);
$this->add_render_attribute( $this->description_key, ['class'=> 'wpr-description']);
}
public function render_image_or_icon($content) {
if( ( isset($content['repeater_image']['id']) && $content['repeater_image']['id'] != "" ) ) {
if($this->thumbnail_size == 'custom'){
$custom_size = [$this->thumbnail_custom_dimension['width'], $this->thumbnail_custom_dimension['height'] ];
$this->image= wp_get_attachment_image($content['repeater_image']['id'], $custom_size , true);
}
else{
$this->image= wp_get_attachment_image($content['repeater_image']['id'], $this->thumbnail_size, true);
}
} elseif (isset($content['repeater_image']['url']) && $content['repeater_image']['url'] != "") {
$this->image = '
';
} elseif ($content['repeater_timeline_item_icon'] != '') {
ob_start();
\Elementor\Icons_Manager::render_icon( $content['repeater_timeline_item_icon'], [ 'aria-hidden' => 'true' ] );
$icon_image = ob_get_clean();
$this->image = $icon_image;
} else {
$this->image ='';
}
}
public function wpr_render_swiper_navigation($settings) {
echo '
'. \WprAddons\Classes\Utilities::get_wpr_icon( $settings['swiper_nav_icon'], '' ) .'
'. \WprAddons\Classes\Utilities::get_wpr_icon( $settings['swiper_nav_icon'], '' ) .'
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
public function render_pagination($settings, $paged) {}
// Get Animation Class
public function get_animation_class( $data, $object ) {
$class = '';
// Animation Class
if ( 'none' !== $data[ $object .'_animation'] ) {
$class .= ' wpr-'. $object .'-'. $data[ $object .'_animation'];
$class .= ' wpr-anim-size-'. $data[ $object .'_animation_size'];
$class .= ' wpr-anim-timing-'. $data[ $object .'_animation_timing'];
if ( 'yes' === $data[ $object .'_animation_tr'] ) {
$class .= ' wpr-anim-transparency';
}
}
return $class;
}
public static function youtube_url ( $story_settings ) {
if ( $story_settings['repeater_youtube_video_url'] != '' ) {
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $story_settings['repeater_youtube_video_url'], $matches);
if ( isset($matches[1]) ) {
$id = $matches[1];
$media = ' '. esc_html__($settings['query_not_found_text']) .'
';
}
if ( $this->my_query->have_posts() ) {
echo '