'bottom' => 0,
'left' => 2,
],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-arrow' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'gallery_slider_nav_border_type!' => 'none',
],
]
);
$this->add_control(
'gallery_slider_nav_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-arrow' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'after',
]
);
$this->add_responsive_control(
'gallery_slider_nav_position_top',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Vertical Position', 'wpr-addons' ),
'size_units' => [ '%', 'px' ],
'range' => [
'%' => [
'min' => -20,
'max' => 120,
],
'px' => [
'min' => -200,
'max' => 2000,
],
],
'default' => [
'unit' => '%',
'size' => 50,
],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-arrow' => 'top: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'gallery_slider_nav_position_left',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Left Position', 'wpr-addons' ),
'size_units' => [ '%', 'px' ],
'range' => [
'%' => [
'min' => -20,
'max' => 120,
],
'px' => [
'min' => -200,
'max' => 2000,
],
],
'default' => [
'unit' => '%',
'size' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-prev-arrow' => 'left: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'gallery_slider_nav_position_right',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Right Position', 'wpr-addons' ),
'size_units' => [ '%', 'px' ],
'range' => [
'%' => [
'min' => -20,
'max' => 120,
],
'px' => [
'min' => -200,
'max' => 2000,
],
],
'default' => [
'unit' => '%',
'size' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-next-arrow' => 'right: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section(); // End Controls Section
// Styles ====================
// Section: Pagination -------
$this->start_controls_section(
'wpr__section_style_gallery_slider_dots',
[
'label' => esc_html__( 'Slider Pagination', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'featured_media_pfg_select' => 'meta',
'gallery_display_as' => 'slider',
],
]
);
$this->start_controls_tabs( 'tabs_gallery_slider_dots' );
$this->start_controls_tab(
'tab_gallery_slider_dots_normal',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'gallery_slider_dots_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => 'rgba(0,0,0,0.35)',
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dot' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'gallery_slider_dots_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dot' => 'border-color: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_gallery_slider_dots_active',
[
'label' => esc_html__( 'Active', 'wpr-addons' ),
]
);
$this->add_control(
'gallery_slider_dots_active_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#222222',
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dots .slick-active .wpr-gallery-slider-dot' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'gallery_slider_dots_active_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dots .slick-active .wpr-gallery-slider-dot' => 'border-color: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_responsive_control(
'gallery_slider_dots_size',
[
'label' => esc_html__( 'Box Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%'],
'range' => [
'px' => [
'min' => 5,
'max' => 200,
],
],
'default' => [
'unit' => 'px',
'size' => 8,
],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dot' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'gallery_slider_dots_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-gallery-slider-dot' => 'border-style: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'gallery_slider_dots_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-gallery-slider-dot' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'gallery_slider_dots_border_type!' => 'none',
],
]
);
$this->add_control(
'gallery_slider_dots_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 50,
'right' => 50,
'bottom' => 50,
'left' => 50,
'unit' => '%',
],
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dot' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'gallery_slider_dots_gutter',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Gutter', 'wpr-addons' ),
'size_units' => ['px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 7,
],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dot' => 'margin-right: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'gallery_slider_dots_hr',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Horizontal Position', 'wpr-addons' ),
'size_units' => [ '%', 'px' ],
'range' => [
'%' => [
'min' => -20,
'max' => 120,
],
'px' => [
'min' => -200,
'max' => 2000,
],
],
'default' => [
'unit' => '%',
'size' => 50,
],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dots' => 'left: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'gallery_slider_dots_vr',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Vertical Position', 'wpr-addons' ),
'size_units' => [ '%', 'px' ],
'range' => [
'%' => [
'min' => -20,
'max' => 120,
],
'px' => [
'min' => -200,
'max' => 2000,
],
],
'default' => [
'unit' => '%',
'size' => 96,
],
'selectors' => [
'{{WRAPPER}} .wpr-gallery-slider-dots' => 'top: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section(); // End Controls Section
}
public function get_lightbox_settings( $settings ) {
$lightbox_settings = [
'selector' => '.slick-slide:not(.slick-cloned) .wpr-featured-media-image, .wpr-featured-media-wrap > .wpr-featured-media-image',
'iframeMaxWidth' => '60%',
'hash' => false,
'autoplay' => $settings['lightbox_popup_autoplay'],
'pause' => $settings['lightbox_popup_pause'] * 1000,
'progressBar' => $settings['lightbox_popup_progressbar'],
'counter' => $settings['lightbox_popup_counter'],
'controls' => $settings['lightbox_popup_arrows'],
'getCaptionFromTitleOrAlt' => $settings['lightbox_popup_captions'],
'thumbnail' => $settings['lightbox_popup_thumbnails'],
'showThumbByDefault' => $settings['lightbox_popup_thumbnails_default'],
'share' => $settings['lightbox_popup_sharing'],
'zoom' => $settings['lightbox_popup_zoom'],
'fullScreen' => $settings['lightbox_popup_fullscreen'],
'download' => $settings['lightbox_popup_download'],
];
return json_encode( $lightbox_settings );
}
// Render Post Thumbnail
public function render_post_thumbnail( $settings, $id ) {
$lightbox = '';
$src = Group_Control_Image_Size::get_attachment_image_src( $id, 'featured_media_image_crop', $settings );
$caption = wp_get_attachment_caption( $id );
// Lightbox
// if ( 'yes' === $settings['featured_media_lightbox'] ) {
// $lightbox = ' data-lightbox="'. esc_attr( $this->get_lightbox_settings( $settings ) ) .'"';
// }
// if ( $id === get_post_thumbnail_id() && false === get_post_format() ) {
// $show_caption = $settings['featured_media_caption'];
// } else {
// $show_caption = $settings['gallery_caption'];
// }
$show_caption = $settings['featured_media_caption'];
// Render Image
if ( has_post_thumbnail() ) {
$alt = get_post_meta($id, '_wp_attachment_image_alt', true);
echo '
';
}
}
public function render_post_audio_video( $settings, $post_format ) {
$utilities = new Utilities();
$meta_value = get_post_meta( get_the_ID(), $settings[ 'featured_media_'. $post_format ], true );
// Checks
if ( '' === $meta_value ) {
return;
}
// URL
if ( false === strpos( $meta_value, '
';
// Audio
} else {
$track_url = ( '' === $settings['audio_auto_play'] ) ? str_replace( 'auto_play=true', '', $track_url ) : $track_url;
$audio_height = 'yes' === $settings['audio_visual_player'] ? '400' : '200';
// SoundCloud Color
if ( strpos( $track_url, 'ff5500' ) ) {
$track_url = str_replace( 'ff5500', str_replace( '#', '', $settings['audio_interface_color'] ), $track_url );
} else {
$track_url .= str_replace( '#', 'color=', $settings['audio_interface_color'] );
}
echo '';
// Disable Post Formats for some time
// switch ( $post_format ) {
// case 'audio':
// if ( 'meta' === $settings['featured_media_pfa_select'] ) {
// $this->render_post_audio_video( $settings, 'audio' );
// } else {
// $this->render_post_thumbnail( $settings, $thumb_id );
// }
// break;
// case 'video':
// if ( 'meta' === $settings['featured_media_pfv_select'] ) {
// $this->render_post_audio_video( $settings, 'video' );
// } else {
// $this->render_post_thumbnail( $settings, $thumb_id );
// }
// break;
// case 'gallery':
// if ( 'meta' === $settings['featured_media_pfg_select'] ) {
// $this->render_post_gallery( $settings );
// } else {
// $this->render_post_thumbnail( $settings, $thumb_id );
// }
// break;
// default:
// $this->render_post_thumbnail( $settings, $thumb_id );
// break;
// }
$this->render_post_thumbnail( $settings, $thumb_id );
echo '
';
}
}