ticker_name = esc_html__( 'News Ticker', 'advanced-news-ticker' ); $this->ticker_base = 'advanced-news-ticker'; parent::__construct( $data, $args ); } public function get_script_depends() { return [ 'advanced-news-ticker-scripts' ]; } public function get_style_depends() { return [ 'advanced-news-ticker-styles' ]; } /** * Register Controls * * @return void */ protected function register_controls() { $this->general_settings(); $this->query(); $this->ticker_style(); $this->ticker_title(); $this->ticker_post_title(); $this->ticker_control(); } protected function general_settings() { $this->start_controls_section( 'sec_general', [ 'label' => esc_html__( 'General', 'advanced-news-ticker' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'layout', [ 'type' => 'advanced-news-ticker-image-select', 'label' => esc_html__( 'Choose Layout', 'advanced-news-ticker' ), 'description' => esc_html__( 'Choose layout', 'advanced-news-ticker' ), 'options' => [ '1' => [ 'title' => esc_html__( 'Layout 1', 'advanced-news-ticker' ), 'url' => esc_url( Fns::get_assets_url( 'images/layout/newsticker-1.svg' ) ), ], '2' => [ 'title' => esc_html__( 'Layout 2', 'advanced-news-ticker' ), 'url' => esc_url( Fns::get_assets_url( 'images/layout/newsticker-2.svg' ) ), ], '3' => [ 'title' => esc_html__( 'Layout 3', 'advanced-news-ticker' ), 'url' => esc_url( Fns::get_assets_url( 'images/layout/newsticker-3.svg' ) ), ], '4' => [ 'title' => esc_html__( 'Layout 4', 'advanced-news-ticker' ), 'url' => esc_url( Fns::get_assets_url( 'images/layout/newsticker-4.svg' ) ), ], '5' => [ 'title' => esc_html__( 'Layout 5', 'advanced-news-ticker' ), 'url' => esc_url( Fns::get_assets_url( 'images/layout/newsticker-5.svg' ) ), ], '6' => [ 'title' => esc_html__( 'Layout 6', 'advanced-news-ticker' ), 'url' => esc_url( Fns::get_assets_url( 'images/layout/newsticker-6.svg' ) ), ], '7' => [ 'title' => esc_html__( 'Layout 7', 'advanced-news-ticker' ), 'url' => esc_url( Fns::get_assets_url( 'images/layout/newsticker-7.svg' ) ), ], '8' => [ 'title' => esc_html__( 'Layout 8', 'advanced-news-ticker' ), 'url' => esc_url( Fns::get_assets_url( 'images/layout/newsticker-8.svg' ) ), ], ], 'classes' => 'columns-2', 'default' => '1', 'prefix_class' => 'ticker-style-', 'render_type' => 'template', ] ); $this->add_control( 'title', [ 'label' => esc_html__( 'Breaking Title', 'advanced-news-ticker' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Breaking News', 'advanced-news-ticker' ), ] ); $this->add_control( 'control_visibility', [ 'type' => \Elementor\Controls_Manager::SWITCHER, 'label' => esc_html__( 'Controls Button Visibility', 'advanced-news-ticker' ), 'label_on' => esc_html__( 'On', 'advanced-news-ticker' ), 'label_off' => esc_html__( 'Off', 'advanced-news-ticker' ), 'default' => 'yes', ] ); $this->add_control( 'pause_visibility', [ 'type' => \Elementor\Controls_Manager::SWITCHER, 'label' => esc_html__( 'Pause Button Visibility', 'advanced-news-ticker' ), 'label_on' => esc_html__( 'On', 'advanced-news-ticker' ), 'label_off' => esc_html__( 'Off', 'advanced-news-ticker' ), 'default' => 'yes', 'condition' => [ 'control_visibility' => 'yes', ] ] ); $this->add_control( 'ticker_settings', [ 'label' => esc_html__( 'Ticker Settings', 'advanced-news-ticker' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'ticker_animation', [ 'label' => esc_html__( 'Animation', 'advanced-news-ticker' ), 'type' => Controls_Manager::SELECT, 'default' => 'horizontal', 'options' => [ 'horizontal' => esc_html__( 'Slide Horizontal', 'advanced-news-ticker' ), 'vertical' => esc_html__( 'Slide Vertical', 'advanced-news-ticker' ), 'type' => esc_html__( 'Typing', 'advanced-news-ticker' ), 'marquee' => esc_html__( 'Marquee Scroll', 'advanced-news-ticker' ), ], ] ); $this->add_control( 'marquee_direction', [ 'label' => esc_html__( 'Direction', 'advanced-news-ticker' ), 'type' => Controls_Manager::SELECT, 'default' => 'right', 'options' => [ 'right' => esc_html__( 'Right', 'advanced-news-ticker' ), 'left' => esc_html__( 'Left', 'advanced-news-ticker' ), ], 'condition' => [ 'ticker_animation' => 'marquee', ] ] ); $this->add_control( 'scrollamount', [ 'label' => esc_html__( 'Speed', 'advanced-news-ticker' ), 'type' => Controls_Manager::NUMBER, 'default' => 5, 'condition' => [ 'ticker_animation' => 'marquee', ] ] ); $this->add_control( 'speed', [ 'label' => esc_html__( 'Speed', 'advanced-news-ticker' ), 'type' => Controls_Manager::NUMBER, 'default' => 300, 'condition' => [ 'ticker_animation!' => 'marquee', ] ] ); $this->add_control( 'delay', [ 'label' => esc_html__( 'Delay', 'advanced-news-ticker' ), 'type' => Controls_Manager::NUMBER, 'default' => 1500, 'condition' => [ 'ticker_animation!' => 'marquee', ] ] ); // No condition: both swiper_slider() and marquee_slider() honour this, so the // control must stay active for every animation mode. get_settings_for_display() // strips controls whose conditions are unmet, which would silently disable // hover-pause for the marquee layout. $this->add_control( 'pause_on_hover', [ 'label' => esc_html__( 'Pause On Hover', 'advanced-news-ticker' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'On', 'advanced-news-ticker' ), 'label_off' => esc_html__( 'Off', 'advanced-news-ticker' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->end_controls_section(); } protected function query() { $this->start_controls_section( 'query_section', [ 'label' => esc_html__( 'Query', 'advanced-news-ticker' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $post_types = Fns::get_post_types(); $this->add_control( 'post_type', [ 'label' => esc_html__( 'Post Type', 'advanced-news-ticker' ), 'type' => Controls_Manager::SELECT, 'options' => $post_types, 'default' => 'post', ] ); $this->add_control( 'post_limit', [ 'label' => esc_html__( 'Post Per Page', 'advanced-news-ticker' ), 'type' => Controls_Manager::TEXT, 'placeholder' => esc_html__( 'Enter Post Limit', 'advanced-news-ticker' ), 'description' => esc_html__( 'Enter number of post to show.', 'advanced-news-ticker' ), 'default' => '12', ] ); foreach ( $post_types as $post_type => $post_label ) { $this->add_control( $post_type . '_ids', [ 'type' => 'advanced-news-ticker-select2', /* translators: %s: post type label. */ 'label' => sprintf( esc_html__( 'Choose %s', 'advanced-news-ticker' ), $post_label ), 'source_name' => 'post_type', 'source_type' => $post_type, 'multiple' => true, 'label_block' => true, 'minimum_input_length' => 3, 'condition' => [ 'post_type' => $post_type, ], ] ); } $taxonomies = get_taxonomies( [], 'objects' ); foreach ( $taxonomies as $taxonomy => $object ) { if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ), true ) || in_array( $taxonomy, Fns::get_excluded_taxonomy(), true ) ) { continue; } $this->add_control( $taxonomy . '_ids', [ /* translators: %s: taxonomy label. */ 'label' => sprintf( esc_html__( 'By %s', 'advanced-news-ticker' ), $object->label ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => Fns::get_categories_by_id( $taxonomy ), 'condition' => [ 'post_type' => $object->object_type, ], /* translators: %s: taxonomy label. */ 'description' => sprintf( esc_html__( 'Post by %s', 'advanced-news-ticker' ), $object->label ), ] ); } $this->add_control( 'tax_relation', [ 'label' => esc_html__( 'Taxonomy Relation', 'advanced-news-ticker' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'OR' => esc_html__( 'OR', 'advanced-news-ticker' ), 'AND' => esc_html__( 'AND', 'advanced-news-ticker' ), ], 'default' => 'OR', ] ); $this->add_control( 'offset', [ 'label' => esc_html__( 'Post offset', 'advanced-news-ticker' ), 'type' => Controls_Manager::TEXT, 'placeholder' => esc_html__( 'Enter Post offset', 'advanced-news-ticker' ), 'description' => esc_html__( 'Number of post to displace or pass over. The offset parameter is ignored when post limit => -1 (show all posts) is used.', 'advanced-news-ticker' ), ] ); $this->add_control( 'exclude', [ 'type' => 'advanced-news-ticker-select2', 'label' => esc_html__( 'Exclude posts', 'advanced-news-ticker' ), 'description' => esc_html__( 'Choose posts for exclude', 'advanced-news-ticker' ), 'source_name' => 'post', 'source_type' => 'post', 'multiple' => true, 'label_block' => true, 'minimum_input_length' => 3, ] ); $this->add_control( 'orderby', [ 'label' => esc_html__( 'Order by', 'advanced-news-ticker' ), 'type' => Controls_Manager::SELECT, 'default' => 'date', 'options' => [ 'date' => esc_html__( 'Date', 'advanced-news-ticker' ), 'ID' => esc_html__( 'Order by post ID', 'advanced-news-ticker' ), 'author' => esc_html__( 'Author', 'advanced-news-ticker' ), 'title' => esc_html__( 'Title', 'advanced-news-ticker' ), 'modified' => esc_html__( 'Last modified date', 'advanced-news-ticker' ), 'parent' => esc_html__( 'Post parent ID', 'advanced-news-ticker' ), 'comment_count' => esc_html__( 'Number of comments', 'advanced-news-ticker' ), 'menu_order' => esc_html__( 'Menu order', 'advanced-news-ticker' ), 'meta_value' => esc_html__( 'Meta value', 'advanced-news-ticker' ), 'meta_value_num' => esc_html__( 'Meta value number', 'advanced-news-ticker' ), 'rand' => esc_html__( 'Random order', 'advanced-news-ticker' ), ], ] ); $this->add_control( 'meta_key', [ 'label' => esc_html__( 'Meta Key', 'advanced-news-ticker' ), 'type' => Controls_Manager::TEXT, 'condition' => [ 'orderby' => [ 'meta_value', 'meta_value_num' ], ], ] ); $this->add_control( 'order', [ 'label' => esc_html__( 'Sort order', 'advanced-news-ticker' ), 'type' => Controls_Manager::SELECT, 'default' => 'DESC', 'options' => [ 'ASC' => esc_html__( 'ASC', 'advanced-news-ticker' ), 'DESC' => esc_html__( 'DESC', 'advanced-news-ticker' ), ], ] ); $this->end_controls_section(); } /** * Newsticker Style * * @return void */ public function ticker_style() { $this->start_controls_section( 'ticker_style', [ 'label' => esc_html__( 'News Ticker', 'advanced-news-ticker' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'border_radius', [ 'label' => esc_html__( 'Border Radius', 'advanced-news-ticker' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} :is(.advanced-news-ticker-inner, .ticker-title, .navigation .news-ticker-nav)' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'padding', [ 'label' => esc_html__( 'Padding', 'advanced-news-ticker' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'ticker_border', 'label' => esc_html__( 'Border', 'advanced-news-ticker' ), 'selector' => '{{WRAPPER}} .advanced-news-ticker-inner', ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'ticker_background_color', 'label' => esc_html__( 'Title Background', 'advanced-news-ticker' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .advanced-news-ticker-inner', 'exclude' => [ 'image' ], 'fields_options' => [ 'background' => [ 'label' => esc_html__( 'Title Background', 'advanced-news-ticker' ), ], 'color' => [ 'label' => 'Background Color', ], 'color_b' => [ 'label' => 'Background Color 2', ], ], ] ); $this->add_control( 'height', [ 'label' => esc_html__( 'Height', 'advanced-news-ticker' ), 'type' => Controls_Manager::NUMBER, 'min' => 30, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner' => 'height:{{VALUE}}px;', ], ] ); $this->end_controls_section(); } /** * Newsticker Title settings * * @return void */ public function ticker_title() { $this->start_controls_section( 'ticker_title', [ 'label' => esc_html__( 'Breaking Title', 'advanced-news-ticker' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'breaking_title_typography', 'label' => esc_html__( 'Typography', 'advanced-news-ticker' ), 'selector' => '{{WRAPPER}} .advanced-news-ticker-inner .ticker-title', ] ); $this->add_control( 'breaking_title_color', [ 'label' => esc_html__( 'Title Color', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-title' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'title_background_color', 'label' => esc_html__( 'Title Background', 'advanced-news-ticker' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .advanced-news-ticker-inner .ticker-title', 'exclude' => [ 'image' ], 'fields_options' => [ 'background' => [ 'label' => esc_html__( 'Title Background', 'advanced-news-ticker' ), ], 'color' => [ 'label' => 'Background Color', ], 'color_b' => [ 'label' => 'Background Color 2', ], ], ] ); $this->add_control( 'breaking_radius', [ 'label' => esc_html__( 'Border Radius', 'advanced-news-ticker' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-title' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'breaking_border', 'label' => esc_html__( 'Border', 'advanced-news-ticker' ), 'selector' => '{{WRAPPER}} .advanced-news-ticker-inner .ticker-title', ] ); /** * Icon Settings */ $this->add_control( 'title_icon_heading', [ 'label' => esc_html__( 'Icon Setting', 'advanced-news-ticker' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'show_icon', [ 'label' => esc_html__( 'Show Icon', 'advanced-news-ticker' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'breaking_icon', [ 'label' => esc_html__( 'Choose Icon', 'advanced-news-ticker' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => esc_html__( 'Default', 'advanced-news-ticker' ), 'bolt-round' => esc_html__( 'Bolt Circle', 'advanced-news-ticker' ), 'bolt-round-2' => esc_html__( 'Bolt Circle 2', 'advanced-news-ticker' ), 'bolt-round-3' => esc_html__( 'Bolt Circle 3', 'advanced-news-ticker' ), 'bolt' => esc_html__( 'Bolt Light', 'advanced-news-ticker' ), 'bolt-2' => esc_html__( 'Bolt Solid', 'advanced-news-ticker' ), 'live' => esc_html__( 'Live Circle', 'advanced-news-ticker' ), 'custom' => esc_html__( 'Custom Icon', 'advanced-news-ticker' ), ], 'condition' => [ 'show_icon' => 'yes', ] ] ); $this->add_control( 'title_icon', [ 'label' => esc_html__( 'Choose Icon', 'advanced-news-ticker' ), 'type' => Controls_Manager::ICONS, 'condition' => [ 'show_icon' => 'yes', 'breaking_icon' => 'custom', ] ] ); $this->add_control( 'live_animation', [ 'label' => esc_html__( 'Live Animation', 'advanced-news-ticker' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => false, 'return_value' => 'yes', 'prefix_class' => 'live-animation-', 'condition' => [ 'show_icon' => 'yes', ] ] ); $this->add_responsive_control( 'breaking_icon_size', [ 'label' => esc_html__( 'Icon Size', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 5, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ticker-title :is(i, svg)' => 'font-size: {{SIZE}}px;', ], 'condition' => [ 'show_icon' => 'yes', ] ] ); $this->add_control( 'breaking_icon_color', [ 'label' => esc_html__( 'Icon Color', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-title :is(i, svg)' => 'color: {{VALUE}}', ], 'condition' => [ 'show_icon' => 'yes', ] ] ); $this->add_control( 'title_position', [ 'label' => esc_html__( 'Position Tune (optional)', 'advanced-news-ticker' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_responsive_control( 'title_icon_y_post', [ 'label' => esc_html__( 'Icon Vertical Position', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => - 30, 'max' => 30, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-live-icon' => 'transform: translateY({{SIZE}}px)', ], 'condition' => [ 'show_icon' => 'yes', ] ] ); $this->add_responsive_control( 'title_y_post', [ 'label' => esc_html__( 'Title Vertical Position', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => - 40, 'max' => 40, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .breaking-title' => 'transform: translateY({{SIZE}}px)', ], ] ); $this->end_controls_section(); } /** * Newsticker Post Title * * @return void */ public function ticker_post_title() { $this->start_controls_section( 'ticker_post_title', [ 'label' => esc_html__( 'Post Title', 'advanced-news-ticker' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'post_typography', 'label' => esc_html__( 'Typography', 'advanced-news-ticker' ), 'selector' => '{{WRAPPER}} .advanced-news-ticker-inner .post-link', ] ); $this->add_control( 'post_title_link', [ 'label' => esc_html__( 'Enable Link?', 'advanced-news-ticker' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'post_icon', [ 'label' => esc_html__( 'Icon', 'advanced-news-ticker' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'star' => esc_html__( 'Star Icon', 'advanced-news-ticker' ), 'star-outline' => esc_html__( 'Star-Outline Icon', 'advanced-news-ticker' ), 'dot' => esc_html__( 'Dot Icon', 'advanced-news-ticker' ), 'bolt-round' => esc_html__( 'Bolt Circle', 'advanced-news-ticker' ), 'bolt-round-2' => esc_html__( 'Bolt Circle 2', 'advanced-news-ticker' ), 'bolt-round-3' => esc_html__( 'Bolt Circle 3', 'advanced-news-ticker' ), 'bolt' => esc_html__( 'Bolt Light', 'advanced-news-ticker' ), 'bolt-2' => esc_html__( 'Bolt Solid', 'advanced-news-ticker' ), 'live' => esc_html__( 'Live Circle', 'advanced-news-ticker' ), 'custom' => esc_html__( 'Custom Icon', 'advanced-news-ticker' ), ], 'default' => 'live', ] ); $this->add_control( 'custom_post_icon', [ 'label' => esc_html__( 'Custom Icon', 'advanced-news-ticker' ), 'type' => Controls_Manager::ICONS, 'default' => [ 'value' => 'far fa-circle', 'library' => 'fa-regular', ], 'condition' => [ 'post_icon' => 'custom', ], ] ); $this->add_responsive_control( 'post_icon_size', [ 'label' => esc_html__( 'Icon Size', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 4, 'max' => 50, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-content :is(svg, i)' => 'font-size: {{SIZE}}px;', ], 'condition' => [ 'post_icon!' => 'none', ], ] ); $this->add_responsive_control( 'post_icon_gap', [ 'label' => esc_html__( 'Icon Gap', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-content :is(svg, i)' => 'margin-right: {{SIZE}}px;', '{{WRAPPER}} .advanced-news-ticker-inner .post-link' => 'margin-right: {{SIZE}}px;', ], 'condition' => [ 'post_icon!' => 'none', ], ] ); $this->add_control( 'post_title_color', [ 'label' => esc_html__( 'Title Color', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .post-link' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'post_title_color_hover', [ 'label' => esc_html__( 'Title Color:hover', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .post-link:hover' => 'color: {{VALUE}}', ], 'condition' => [ 'post_title_link' => 'yes', ], ] ); $this->add_control( 'post_icon_color', [ 'label' => esc_html__( 'Icon Color', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-content :is(i, svg)' => 'color: {{VALUE}}', ], 'condition' => [ 'post_icon!' => 'none', ], ] ); $this->add_responsive_control( 'post_title_icon_pos', [ 'label' => esc_html__( 'Icon Vertical Position', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => - 20, 'max' => 20, 'step' => .5, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-content .post-icon' => 'transform:translateY({{SIZE}}{{UNIT}});', ], ] ); $this->add_responsive_control( 'post_title_pos', [ 'label' => esc_html__( 'Title Vertical Position', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => - 20, 'max' => 20, 'step' => .5, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .ticker-content .post-link' => 'transform:translateY({{SIZE}}{{UNIT}});', ], ] ); $this->end_controls_section(); } /** * Newsticker Control * * @return void */ public function ticker_control() { $this->start_controls_section( 'ticker_control', [ 'label' => esc_html__( 'Control Button', 'advanced-news-ticker' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'ticker_animation!' => 'marquee', 'control_visibility' => 'yes' ], ] ); $this->add_control( 'control_prev_icon', [ 'label' => esc_html__( 'Prev Icon', 'advanced-news-ticker' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'recommended' => [ 'fa-solid' => [ 'chevron-left', 'angle-left', 'angle-double-left', 'caret-left', 'arrow-left', 'caret-square-left', 'long-arrow-alt-left' ], 'fa-regular' => [ 'caret-square-left', 'arrow-right', ], ], 'skin' => 'inline', 'label_block' => false, ] ); $this->add_control( 'control_next_icon', [ 'label' => esc_html__( 'Next Icon', 'advanced-news-ticker' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'recommended' => [ 'fa-solid' => [ 'chevron-right', 'angle-right', 'angle-double-right', 'caret-right', 'arrow-right', 'caret-square-right', 'long-arrow-alt-right' ], 'fa-regular' => [ 'caret-square-right', 'arrow-right', ], ], 'skin' => 'inline', 'label_block' => false, ] ); $this->add_control( 'control_pause_icon', [ 'label' => esc_html__( 'Pause Icon', 'advanced-news-ticker' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'recommended' => [ 'fa-solid' => [ 'pause', 'pause-circle' ], 'fa-regular' => [ 'pause-circle', ], ], 'skin' => 'inline', 'label_block' => false, ] ); $this->add_responsive_control( 'control_radius', [ 'label' => esc_html__( 'Border Radius', 'advanced-news-ticker' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .navigation .news-ticker-nav' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'icon_size', [ 'label' => esc_html__( 'Icon Size', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 60, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .news-ticker-nav :is(svg, i)' => 'font-size:{{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'icon_width', [ 'label' => esc_html__( 'Icon Width', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 8, 'max' => 60, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .navigation .news-ticker-nav' => 'width:{{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'icon_height', [ 'label' => esc_html__( 'Icon Height', 'advanced-news-ticker' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 8, 'max' => 60, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .navigation .news-ticker-nav' => 'height:{{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'control_color', [ 'label' => esc_html__( 'Icon Color', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .navigation .news-ticker-nav' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'control_color_h', [ 'label' => esc_html__( 'Icon color:hover', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .navigation .news-ticker-nav:hover' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'control_bg', [ 'label' => esc_html__( 'Control Background', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .navigation .news-ticker-nav' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'control_bg_h', [ 'label' => esc_html__( 'Control Background:hover', 'advanced-news-ticker' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .advanced-news-ticker-inner .navigation .news-ticker-nav:hover' => 'background-color: {{VALUE}}', ], ] ); $this->end_controls_section(); } public function swiper_slider( $query, $data ) { $ticker_animation = $data['ticker_animation'] ?? 'horizontal'; $speed = isset( $data['speed'] ) && '' !== $data['speed'] ? absint( $data['speed'] ) : 300; $delay = isset( $data['delay'] ) && '' !== $data['delay'] ? absint( $data['delay'] ) : 2000; if ( 'type' === $ticker_animation ) { $speed = 0; } $swiperConfig = [ 'slidesPerView' => 1, 'speed' => $speed, 'effect' => 'fade', 'loop' => true, 'allowTouchMove' => false, 'pauseOnMouseEnter' => ( 'yes' === ( $data['pause_on_hover'] ?? '' ) ), 'autoplay' => [ 'delay' => $delay, 'disableOnInteraction' => true, ], 'navigation' => [ 'nextEl' => '.newsticker-button-next', 'prevEl' => '.newsticker-button-prev', ], ]; if ( in_array( $ticker_animation, [ 'vertical', 'horizontal' ], true ) ) { $swiperConfig['parallax'] = true; } $animation = ''; if ( 'vertical' === $ticker_animation ) { $animation = 'data-swiper-parallax-y="-40"'; } if ( 'horizontal' === $ticker_animation ) { $animation = 'data-swiper-parallax="-120"'; } $show_controls = 'yes' === ( $data['control_visibility'] ?? '' ); $show_pause = 'yes' === ( $data['pause_visibility'] ?? '' ); $link_title = 'yes' === ( $data['post_title_link'] ?? '' ); ?>
%s
', esc_html__( 'No posts found for the current query settings.', 'advanced-news-ticker' ) ); } return; } ?>