Sid Gifari File Manager
🏠 Root
/
home
/
ailwtbdh
/
public_html
/
wp-content
/
plugins
/
profundcore
/
addons
/
widgets
/
Editing: post-slider.php
<?php namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; class profund_Widget_Post_Carousel extends Widget_Base { /** * Get widget name. * * Retrieve button widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'profund-postcarousel-addons'; } public function get_script_depends() { return [ 'slick', 'el-widget-active' ]; } /** * Get widget title. * * Retrieve button widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return __( 'Post Carousel', 'profundcore' ); } /** * Get widget icon. * * Retrieve button widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'eicon-posts-carousel'; } /** * Get widget categories. * * Retrieve the list of categories the button widget belongs to. * * Used to determine where to display the widget in the editor. * * @since 2.0.0 * @access public * * @return array Widget categories. */ public function get_categories() { return [ 'profund-addons' ]; } protected function register_controls() { $this->start_controls_section( 'post_carousel_content', [ 'label' => __( 'Post Settings', 'profundcore' ), ] ); $this->add_control( 'slider_on', [ 'label' => __( 'Carousel', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'On', 'profundcore' ), 'label_off' => __( 'Off', 'profundcore' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'carousel_post_type', [ 'label' => esc_html__( 'Content Sourse', 'profundcore' ), 'type' => Controls_Manager::SELECT2, 'label_block' => false, 'options' => profund_get_post_types(), ] ); $this->add_control( 'carousel_categories', [ 'label' => esc_html__( 'Categories', 'profundcore' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => profund_get_taxonomies(), 'condition' =>[ 'carousel_post_type' => 'post', ] ] ); $this->add_control( 'carousel_prod_categories', [ 'label' => esc_html__( 'Categories', 'profundcore' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => profund_get_taxonomies('product_cat'), 'condition' =>[ 'carousel_post_type' => 'product', ] ] ); $this->add_control( 'post_limit', [ 'label' => __('Limit', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'default' => 5, 'separator'=>'before', ] ); $this->add_control( 'custom_order', [ 'label' => esc_html__( 'Custom order', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_control( 'postorder', [ 'label' => esc_html__( 'Order', 'profundcore' ), 'type' => Controls_Manager::SELECT, 'default' => 'DESC', 'options' => [ 'DESC' => esc_html__('Descending','profundcore'), 'ASC' => esc_html__('Ascending','profundcore'), ], 'condition' => [ 'custom_order!' => 'yes', ] ] ); $this->add_control( 'orderby', [ 'label' => esc_html__( 'Orderby', 'profundcore' ), 'type' => Controls_Manager::SELECT, 'default' => 'none', 'options' => [ 'none' => esc_html__('None','profundcore'), 'ID' => esc_html__('ID','profundcore'), 'date' => esc_html__('Date','profundcore'), 'name' => esc_html__('Name','profundcore'), 'title' => esc_html__('Title','profundcore'), 'comment_count' => esc_html__('Comment count','profundcore'), 'rand' => esc_html__('Random','profundcore'), ], 'condition' => [ 'custom_order' => 'yes', ] ] ); $this->add_control( 'show_date', [ 'label' => esc_html__( 'Date', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'show_thumb', [ 'label' => esc_html__( 'Thumbnail', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'show_author', [ 'label' => esc_html__( 'Author', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'show_title', [ 'label' => esc_html__( 'Title', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'title_length', [ 'label' => __( 'Title Length', 'profundcore' ), 'type' => Controls_Manager::NUMBER, 'step' => 1, 'default' => 5, 'condition'=>[ 'show_title'=>'yes', ] ] ); $this->add_control( 'show_content', [ 'label' => esc_html__( 'Content', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_control( 'content_length', [ 'label' => __( 'Content Length', 'profundcore' ), 'type' => Controls_Manager::NUMBER, 'step' => 1, 'default' => 20, 'condition'=>[ 'show_content'=>'yes', ] ] ); $this->add_control( 'show_read_more_btn', [ 'label' => esc_html__( 'Read More', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'read_more_txt', [ 'label' => __( 'Read More button text', 'profundcore' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Read More', 'profundcore' ), 'placeholder' => __( 'Read More', 'profundcore' ), 'label_block'=>true, 'condition'=>[ 'show_read_more_btn'=>'yes', ] ] ); $this->add_control( 'readmore_button', [ 'label' => __( 'Read More icon', 'profundcore' ), 'type' => Controls_Manager::ICON, 'default' => 'flaticon-right-arrow-1', 'condition'=>[ 'show_read_more_btn'=>'yes', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'slider_option', [ 'label' => esc_html__( 'Carousel Option', 'profundcore' ), 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slitems', [ 'label' => esc_html__( 'Slider Items', 'profundcore' ), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 20, 'step' => 1, 'default' => 3, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slarrows', [ 'label' => esc_html__( 'Slider Arrow', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'yes', 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slprevicon', [ 'label' => __( 'Previous icon', 'profundcore' ), 'type' => Controls_Manager::ICON, 'default' => 'fa fa-angle-left', 'condition' => [ 'slider_on' => 'yes', 'slarrows' => 'yes', ] ] ); $this->add_control( 'slnexticon', [ 'label' => __( 'Next icon', 'profundcore' ), 'type' => Controls_Manager::ICON, 'default' => 'fa fa-angle-right', 'condition' => [ 'slider_on' => 'yes', 'slarrows' => 'yes', ] ] ); $this->add_control( 'sldots', [ 'label' => esc_html__( 'Slider dots', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'no', 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slpause_on_hover', [ 'type' => Controls_Manager::SWITCHER, 'label_off' => __('No', 'profundcore'), 'label_on' => __('Yes', 'profundcore'), 'return_value' => 'yes', 'default' => 'yes', 'label' => __('Pause on Hover?', 'profundcore'), 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_responsive_control( 'slider_item_gap', [ 'label' => __( 'Item Gap', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 15, ], 'selectors' => [ '{{WRAPPER}} .slick-slide' => 'margin : 0 {{SIZE}}{{UNIT}};', ], 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slcentermode', [ 'label' => esc_html__( 'Center Mode', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'default' => 'no', 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slcenterpadding', [ 'label' => esc_html__( 'Center padding', 'profundcore' ), 'type' => Controls_Manager::NUMBER, 'min' => 0, 'max' => 500, 'step' => 1, 'default' => 50, 'condition' => [ 'slider_on' => 'yes', 'slcentermode' => 'yes', ] ] ); $this->add_control( 'slautolay', [ 'label' => esc_html__( 'Slider auto play', 'profundcore' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'no', 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slautoplay_speed', [ 'label' => __('Autoplay speed', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'default' => 3000, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slanimation_speed', [ 'label' => __('Autoplay animation speed', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'default' => 300, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slscroll_columns', [ 'label' => __('Slider item to scroll', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 10, 'step' => 1, 'default' => 1, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'heading_tablet', [ 'label' => __( 'Tablet', 'profundcore' ), 'type' => Controls_Manager::HEADING, 'separator' => 'after', 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'sltablet_display_columns', [ 'label' => __('Slider Items', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 8, 'step' => 1, 'default' => 1, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'sltablet_scroll_columns', [ 'label' => __('Slider item to scroll', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 8, 'step' => 1, 'default' => 1, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'sltablet_width', [ 'label' => __('Tablet Resolution', 'profundcore'), 'description' => __('The resolution to tablet.', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'default' => 750, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'heading_mobile', [ 'label' => __( 'Mobile Phone', 'profundcore' ), 'type' => Controls_Manager::HEADING, 'separator' => 'after', 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slmobile_display_columns', [ 'label' => __('Slider Items', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 4, 'step' => 1, 'default' => 1, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slmobile_scroll_columns', [ 'label' => __('Slider item to scroll', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 4, 'step' => 1, 'default' => 1, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->add_control( 'slmobile_width', [ 'label' => __('Mobile Resolution', 'profundcore'), 'description' => __('The resolution to mobile.', 'profundcore'), 'type' => Controls_Manager::NUMBER, 'default' => 480, 'condition' => [ 'slider_on' => 'yes', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'profundcore_post_area_style_section', [ 'label' => __( 'Area Style', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'post_area_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'post_area_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'post_area_width', [ 'label' => __( 'Width', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Service Style tab section $this->start_controls_section( 'post_column_style_section', [ 'label' => __( 'Column Style', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'slider_on!' => 'yes', ] ] ); $this->add_responsive_control( 'post_column_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profundcore-post-grid .post_item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'post_column_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profundcore-post-grid .post_item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'post_column_width', [ 'label' => __( 'Width', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ] ], 'default' => [ 'unit' => '%', 'size' => 33.33, ], 'selectors' => [ '{{WRAPPER}} .profundcore-post-grid .post_item' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'profundcore_post_box_style_section', [ 'label' => __( 'Box Style', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'post_box_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post_item .post_content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_responsive_control( 'post_box_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post_item .post_content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'profund_post_box_shadow', 'label' => __( 'Box Shadow', 'profundcore' ), 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box', ] ); $this->add_responsive_control( 'profund_post_radius', [ 'label' => esc_html__( 'Border Radius', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', ], ] ); $this->add_responsive_control( 'box_text_align', [ 'label' => __( 'Alignment', 'profundcore' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'profundcore' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'profundcore' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'profundcore' ), 'icon' => 'fa fa-align-right', ], 'justify' => [ 'title' => __( 'Justified', 'profundcore' ), 'icon' => 'fa fa-align-justify', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box' => 'text-align: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'post_slider_title_style_section', [ 'label' => __( 'Title', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition'=>[ 'show_title'=>'yes', ] ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default'=>'#151D41', 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .title a' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'title_hover_color', [ 'label' => __( 'Hover Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default'=>'#55C882', 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .title a:hover' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'label' => __( 'Typography', 'profundcore' ), 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .title', ] ); $this->add_responsive_control( 'title_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'title_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'post_slider_content_style_section', [ 'label' => __( 'Content', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition'=>[ 'show_content'=>'yes', ] ] ); $this->add_control( 'content_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default'=>'rgba(21,29,65,0.6)', 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .desc' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'label' => __( 'Typography', 'profundcore' ), 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .desc', ] ); $this->add_responsive_control( 'content_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .desc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'content_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .post_content .desc' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->end_controls_section(); $this->start_controls_section( 'post_meta_style_section', [ 'label' => __( 'Meta', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'meta_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default'=>'rgba(21,29,65,0.6)', 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .meta-item' => 'color: {{VALUE}}', '{{WRAPPER}} .profund_posts_carousel .post-box .meta-item a' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'meta_hover_color', [ 'label' => __( 'Hover Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default'=>'#55C882', 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .meta-item a:hover' => 'color: {{VALUE}}' ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'meta_typography', 'label' => __( 'Typography', 'profundcore' ), 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box .meta-item', ] ); $this->add_responsive_control( 'meta_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .meta-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'meta_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .meta-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'meta_align', [ 'label' => __( 'Alignment', 'profundcore' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => __( 'Left', 'profundcore' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'profundcore' ), 'icon' => 'fa fa-align-center', ], 'end' => [ 'title' => __( 'Right', 'profundcore' ), 'icon' => 'fa fa-align-right', ], 'justify' => [ 'title' => __( 'Justified', 'profundcore' ), 'icon' => 'fa fa-align-justify', ], ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .meta-item' => 'justify-content: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'post_slider_readmore_style_section', [ 'label' => __( 'Read More', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition'=>[ 'show_read_more_btn'=>'yes', 'read_more_txt!'=>'', ] ] ); $this->start_controls_tabs('readmore_style_tabs'); $this->start_controls_tab( 'readmore_style_normal_tab', [ 'label' => __( 'Normal', 'profundcore' ), ] ); $this->add_control( 'readmore_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default'=>'#55C882', 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'readmore_typography', 'label' => __( 'Typography', 'profundcore' ), 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn', ] ); $this->add_responsive_control( 'readmore_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'readmore_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'readmore_background', 'label' => __( 'Background', 'profundcore' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'readmore_border', 'label' => __( 'Border', 'profundcore' ), 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn', ] ); $this->add_responsive_control( 'readmore_border_radius', [ 'label' => esc_html__( 'Border Radius', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'readmore_style_hover_tab', [ 'label' => __( 'Hover', 'profundcore' ), ] ); $this->add_control( 'readmore_hover_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default'=>'#55C882', 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn:hover' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'readmore_hover_background', 'label' => __( 'Background', 'profundcore' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn:hover', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'readmore_hover_border', 'label' => __( 'Border', 'profundcore' ), 'selector' => '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn:hover', ] ); $this->add_responsive_control( 'readmore_hover_border_radius', [ 'label' => esc_html__( 'Border Radius', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .profund_posts_carousel .post-box .readmore-btn:hover' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'slider_arrow_style', [ 'label' => __( 'Arrow', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' =>[ 'slider_on' => 'yes', 'slarrows' => 'yes', ], ] ); $this->start_controls_tabs( 'slider_arrow_style_tabs' ); // Normal tab Start $this->start_controls_tab( 'slider_arrow_style_normal_tab', [ 'label' => __( 'Normal', 'profundcore' ), ] ); $this->add_control( 'slider_arrow_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default' => '#55C882', 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'slider_arrow_gap', [ 'label' => __( 'Arrow Gap', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => -100, 'max' => 100, 'step' => 1, ] ], 'default' => [ 'unit' => 'px', 'size' => 30, ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow.slick-prev' => 'left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow.slick-next' => 'right: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'slider_arrow_fontsize', [ 'label' => __( 'Font Size', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 16, ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'slider_arrow_background', 'label' => __( 'Background', 'profundcore' ), 'default' => '#ffffff', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'slider_arrow_border', 'label' => __( 'Border', 'profundcore' ), 'selector' => '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow', ] ); $this->add_responsive_control( 'slider_border_radius', [ 'label' => esc_html__( 'Border Radius', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', ], ] ); $this->add_responsive_control( 'slider_arrow_height', [ 'label' => __( 'Height', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 70, ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'slider_arrow_width', [ 'label' => __( 'Width', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 70, ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'slider_arrow_padding', [ 'label' => __( 'Padding', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' =>'before', ] ); $this->end_controls_tab(); // Normal tab end // Hover tab Start $this->start_controls_tab( 'slider_arrow_style_hover_tab', [ 'label' => __( 'Hover', 'profundcore' ), ] ); $this->add_control( 'slider_arrow_hover_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow:hover' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'slider_arrow_hover_background', 'label' => __( 'Background', 'profundcore' ), 'types' => [ 'classic', 'gradient' ], 'default' => '#55C882', 'selector' => '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow:hover', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'slider_arrow_hover_border', 'label' => __( 'Border', 'profundcore' ), 'selector' => '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow:hover', ] ); $this->add_responsive_control( 'slider_arrow_hover_border_radius', [ 'label' => esc_html__( 'Border Radius', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-arrow:hover' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', ], ] ); $this->end_controls_tab(); // Hover tab end $this->end_controls_tabs(); $this->end_controls_section(); // Style Slider arrow style end // Style Pagination button tab section $this->start_controls_section( 'post_slider_pagination_style_section', [ 'label' => __( 'Pagination', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition'=>[ 'slider_on' => 'yes', 'sldots'=>'yes', ] ] ); $this->start_controls_tabs('pagination_style_tabs'); $this->add_responsive_control( 'pagination_alignment', [ 'label' => __( 'Alignment', 'profundcore' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'profundcore' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'profundcore' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'profundcore' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .slick-dots' => 'text-align: {{VALUE}};' ], 'default' => 'center', 'separator' =>'before', ] ); $this->start_controls_tab( 'pagination_style_normal_tab', [ 'label' => __( 'Normal', 'profundcore' ), ] ); $this->add_responsive_control( 'slider_pagination_height', [ 'label' => __( 'Height', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 15, ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li button' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'slider_pagination_width', [ 'label' => __( 'Width', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 15, ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li button' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'pagination_background', 'label' => __( 'Background', 'profundcore' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li button', ] ); $this->add_responsive_control( 'pagination_margin', [ 'label' => __( 'Margin', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'pagination_border', 'label' => __( 'Border', 'profundcore' ), 'selector' => '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li button', ] ); $this->add_responsive_control( 'pagination_border_radius', [ 'label' => esc_html__( 'Border Radius', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li button' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', ], ] ); $this->add_responsive_control( 'pagination_opacity', [ 'label' => __( 'Opacity (%)', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li button' => 'opacity: {{SIZE}}', ], ] ); $this->end_controls_tab(); // Normal Tab end $this->start_controls_tab( 'pagination_style_active_tab', [ 'label' => __( 'Active', 'profundcore' ), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'pagination_hover_background', 'label' => __( 'Background', 'profundcore' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li button:hover, {{WRAPPER}} .profundcore-carousel-activation .slick-dots li.slick-active button', ] ); $this->add_responsive_control( 'slider_pagination_active_width', [ 'label' => __( 'Width', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'unit' => 'px', 'size' => 15, ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li.slick-active button' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'pagination_active_opacity', [ 'label' => __( 'Opacity (%)', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .profundcore-carousel-activation .slick-dots li.slick-active button' => 'opacity: {{SIZE}}', ], ] ); $this->end_controls_tab(); // Hover Tab end $this->end_controls_tabs(); $this->end_controls_section(); } protected function render( $instance = [] ) { $settings = $this->get_settings_for_display(); $custom_order_ck = $this->get_settings_for_display('custom_order'); $orderby = $this->get_settings_for_display('orderby'); $postorder = $this->get_settings_for_display('postorder'); $this->add_render_attribute( 'profund_post_slider_attr', 'class', 'profund_posts_carousel' ); // Slider options if( $settings['slider_on'] == 'yes' ){ $this->add_render_attribute( 'profund_post_slider_attr', 'class', 'profundcore-carousel-activation' ); $slider_settings = [ 'arrows' => ('yes' === $settings['slarrows']), 'arrow_prev_txt' => $settings['slprevicon'], 'arrow_next_txt' => $settings['slnexticon'], 'dots' => ('yes' === $settings['sldots']), 'autoplay' => ('yes' === $settings['slautolay']), 'autoplay_speed' => absint($settings['slautoplay_speed']), 'animation_speed' => absint($settings['slanimation_speed']), 'pause_on_hover' => ('yes' === $settings['slpause_on_hover']), 'center_mode' => ( 'yes' === $settings['slcentermode']), 'center_padding' => absint($settings['slcenterpadding']), ]; $slider_responsive_settings = [ 'display_columns' => $settings['slitems'], 'scroll_columns' => $settings['slscroll_columns'], 'tablet_width' => $settings['sltablet_width'], 'tablet_display_columns' => $settings['sltablet_display_columns'], 'tablet_scroll_columns' => $settings['sltablet_scroll_columns'], 'mobile_width' => $settings['slmobile_width'], 'mobile_display_columns' => $settings['slmobile_display_columns'], 'mobile_scroll_columns' => $settings['slmobile_scroll_columns'], ]; $slider_settings = array_merge( $slider_settings, $slider_responsive_settings ); $this->add_render_attribute( 'profund_post_slider_attr', 'data-settings', wp_json_encode( $slider_settings ) ); }else { $this->add_render_attribute( 'profund_post_slider_attr', 'class', 'profundcore-post-grid' ); } // Query $args = array( 'post_type' => !empty( $settings['carousel_post_type'] ) ? $settings['carousel_post_type'] : 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => !empty( $settings['post_limit'] ) ? $settings['post_limit'] : 3, 'order' => $postorder ); // Custom Order if( $custom_order_ck == 'yes' ){ $args['orderby'] = $orderby; } if( !empty($settings['carousel_prod_categories']) ){ $get_categories = $settings['carousel_prod_categories']; }else{ $get_categories = $settings['carousel_categories']; } $carousel_cats = str_replace(' ', '', $get_categories); if ( !empty( $get_categories ) ) { if( is_array($carousel_cats) and count($carousel_cats) > 0 ){ $field_name = is_numeric( $carousel_cats[0] ) ? 'term_id' : 'slug'; $args['tax_query'] = array( array( 'taxonomy' => ( $settings['carousel_post_type'] == 'product' ) ? 'product_cat' : 'category', 'terms' => $carousel_cats, 'field' => $field_name, 'include_children' => false ) ); } } $carousel_post = new \WP_Query( $args ); ?> <div <?php echo $this->get_render_attribute_string( 'profund_post_slider_attr' ); ?> > <?php if( $carousel_post->have_posts() ): while( $carousel_post->have_posts() ): $carousel_post->the_post(); ?> <div class="post_item"> <div class="post-box"> <?php if( has_post_thumbnail() and $settings['show_thumb'] == true ): ?> <div class="post_image"> <?php the_post_thumbnail(); ?> </div> <?php endif; ?> <?php $this->profundcore_render_loop_content(); ?> </div> </div> <?php endwhile; wp_reset_postdata(); wp_reset_query(); endif; ?> </div> <?php } public function profundcore_render_loop_content( $contetntstyle = NULL ){ $settings = $this->get_settings_for_display(); ?> <div class="post_content"> <div class="post-header"> <?php if( $settings['show_title'] == 'yes' ):?> <h4 class="title" ><a href="<?php the_permalink();?>"><?php echo wp_trim_words( get_the_title(), $settings['title_length'], '' ); ?></a></h4> <?php endif;?> <div class="post-meta"> <?php if( $settings['show_date'] == 'yes' ): ?> <div class="meta-item"><?php echo get_the_date(); ?></div> <?php endif; if( $settings['show_author'] == 'yes' ): ?><div class="meta-item"><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>"><?php echo get_the_author(); ?></a></div> <?php endif; ?> </div> </div> <?php if( $settings['show_content'] == 'yes' ){ echo '<div class="desc"><p>'.wp_trim_words( get_the_content(), $settings['content_length'], '' ).'</p></div>'; } ?> <?php if( $settings['show_read_more_btn'] == 'yes' ): ?> <a class="readmore-btn" href="<?php the_permalink();?>"><?php echo esc_html__( $settings['read_more_txt'], 'profundcore' );?><span class="icon"><i class="<?php echo esc_attr($settings['readmore_button']); ?>"></i></span></a> <?php endif; ?> </div> <?php } } Plugin::instance()->widgets_manager->register_widget_type( new profund_Widget_Post_Carousel );
Save
Cancel