$taxonomy, 'hide_empty' => false, ) ); if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { if ( isset( $term ) ) { if ( isset( $term->slug ) && isset( $term->name ) ) { $options[ $term->slug ] = $term->name; } } } } } return $options; } protected function _register_controls() { $this->wpcap_content_layout_options(); $this->wpcap_content_query_options(); $this->wpcap_style_layout_options(); $this->wpcap_style_box_options(); $this->wpcap_style_image_options(); $this->wpcap_style_title_options(); $this->wpcap_style_meta_options(); $this->wpcap_style_content_options(); $this->wpcap_style_readmore_options(); } /** * Content Layout Options. */ private function wpcap_content_layout_options() { $this->start_controls_section( 'section_layout', [ 'label' => esc_html__( 'Layout', 'aronia' ), ] ); $this->add_control( 'grid_style', [ 'label' => __( 'Grid Style', 'aronia' ), 'type' => Controls_Manager::SELECT, 'default' => '1', 'options' => [ '1' => esc_html__( 'Layout 1', 'aronia' ), '2' => esc_html__( 'Layout 2', 'aronia' ), ], ] ); $this->add_responsive_control( 'columns', [ 'label' => __( 'Columns', 'aronia' ), 'type' => Controls_Manager::SELECT, 'default' => '3', 'tablet_default' => '2', 'mobile_default' => '1', 'options' => [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', ], 'prefix_class' => 'elementor-grid%s-', 'frontend_available' => true, 'selectors' => [ '.elementor-msie {{WRAPPER}} .elementor-portfolio-item' => 'width: calc( 100% / {{SIZE}} )', ], ] ); $this->add_control( 'posts_per_page', [ 'label' => __( 'Posts Per Page', 'aronia' ), 'type' => Controls_Manager::NUMBER, 'default' => 3, ] ); $this->add_control( 'show_image', [ 'label' => __( 'Image', 'aronia' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'aronia' ), 'label_off' => __( 'Hide', 'aronia' ), 'default' => 'yes', 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'post_thumbnail', 'exclude' => [ 'custom' ], 'default' => 'full', 'prefix_class' => 'post-thumbnail-size-', 'condition' => [ 'show_image' => 'yes', ], ] ); $this->add_control( 'show_title', [ 'label' => __( 'Title', 'aronia' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'aronia' ), 'label_off' => __( 'Hide', 'aronia' ), 'default' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'title_tag', [ 'label' => __( 'Title HTML Tag', 'aronia' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', 'span' => 'span', 'p' => 'p', ], 'default' => 'h3', 'condition' => [ 'show_title' => 'yes', ], ] ); $this->add_control( 'meta_data', [ 'label' => __( 'Meta Data', 'aronia' ), 'label_block' => true, 'type' => Controls_Manager::SELECT2, 'default' => [ 'date', 'comments' ], 'multiple' => true, 'options' => [ 'author' => __( 'Author', 'aronia' ), 'date' => __( 'Date', 'aronia' ), 'categories' => __( 'Categories', 'aronia' ), 'comments' => __( 'Comments', 'aronia' ), ], 'separator' => 'before', ] ); $this->add_control( 'meta_separator', [ 'label' => __( 'Separator Between', 'aronia' ), 'type' => Controls_Manager::TEXT, 'default' => '/', 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post .post-grid-meta span + span:before' => 'content: "{{VALUE}}"', ], 'condition' => [ 'meta_data!' => [], ], ] ); $this->add_control( 'show_excerpt', [ 'label' => __( 'Excerpt', 'aronia' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'aronia' ), 'label_off' => __( 'Hide', 'aronia' ), 'default' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'excerpt_length', [ 'label' => __( 'Excerpt Length', 'aronia' ), 'type' => Controls_Manager::NUMBER, /** This filter is documented in wp-includes/formatting.php */ 'default' => apply_filters( 'excerpt_length', 25 ), 'condition' => [ 'show_excerpt' => 'yes', ], ] ); $this->add_control( 'show_read_more', [ 'label' => __( 'Read More', 'aronia' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'aronia' ), 'label_off' => __( 'Hide', 'aronia' ), 'default' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'read_more_text', [ 'label' => __( 'Read More Text', 'aronia' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Read More', 'aronia' ), 'condition' => [ 'show_read_more' => 'yes', ], ] ); $this->add_control( 'content_align', [ 'label' => __( 'Alignment', 'aronia' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'aronia' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'aronia' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'aronia' ), 'icon' => 'fa fa-align-right', ], ], 'default' => 'left', 'selectors' => [ '{{WRAPPER}} .post-grid-inner' => 'text-align: {{VALUE}};', ], 'separator' => 'before', ] ); $this->end_controls_section(); } /** * Content Query Options. */ private function wpcap_content_query_options() { $this->start_controls_section( 'section_query', [ 'label' => __( 'Query', 'aronia' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); // Post categories $this->add_control( 'post_categories', [ 'label' => __( 'Categories', 'aronia' ), 'label_block' => true, 'type' => Controls_Manager::SELECT2, 'multiple' => true, 'options' => $this->wpcap_get_all_post_categories( 'post' ), ] ); $this->add_control( 'advanced', [ 'label' => __( 'Advanced', 'aronia' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'orderby', [ 'label' => __( 'Order By', 'aronia' ), 'type' => Controls_Manager::SELECT, 'default' => 'post_date', 'options' => [ 'post_date' => __( 'Date', 'aronia' ), 'post_title' => __( 'Title', 'aronia' ), 'rand' => __( 'Random', 'aronia' ), ], ] ); $this->add_control( 'order', [ 'label' => __( 'Order', 'aronia' ), 'type' => Controls_Manager::SELECT, 'default' => 'desc', 'options' => [ 'asc' => __( 'ASC', 'aronia' ), 'desc' => __( 'DESC', 'aronia' ), ], ] ); $this->end_controls_section(); } /** * Style Layout Options. */ private function wpcap_style_layout_options() { // Layout. $this->start_controls_section( 'section_layout_style', [ 'label' => __( 'Layout', 'aronia' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); // Columns margin. $this->add_control( 'grid_style_columns_margin', [ 'label' => __( 'Columns margin', 'aronia' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 15, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}', ], ] ); // Row margin. $this->add_control( 'grid_style_rows_margin', [ 'label' => __( 'Rows margin', 'aronia' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 30, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container' => 'grid-row-gap: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_section(); } /** * Style Box Options. */ private function wpcap_style_box_options() { // Box. $this->start_controls_section( 'section_box', [ 'label' => __( 'Box', 'aronia' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); // Image border radius. $this->add_control( 'grid_box_border_width', [ 'label' => __( 'Border Widget', 'aronia' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post' => 'border-style: solid; border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', ], ] ); // Border Radius. $this->add_control( 'grid_style_border_radius', [ 'label' => __( 'Border Radius', 'aronia' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post' => 'border-radius: {{SIZE}}{{UNIT}}', ], ] ); // Box internal padding. $this->add_responsive_control( 'grid_items_style_padding', [ 'label' => __( 'Padding', 'aronia' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', ], ] ); $this->start_controls_tabs( 'grid_button_style' ); // Normal tab. $this->start_controls_tab( 'grid_button_style_normal', [ 'label' => __( 'Normal', 'aronia' ), ] ); // Normal background color. $this->add_control( 'grid_button_style_normal_bg_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Background Color', 'aronia' ), 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'separator' => '', 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post' => 'background-color: {{VALUE}};', ], ] ); // Normal border color. $this->add_control( 'grid_button_style_normal_border_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Border Color', 'aronia' ), 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'separator' => '', 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post' => 'border-color: {{VALUE}};', ], ] ); // Normal box shadow. $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'grid_button_style_normal_box_shadow', 'selector' => '{{WRAPPER}} .wpcap-grid-container .wpcap-post', ] ); $this->end_controls_tab(); // Hover tab. $this->start_controls_tab( 'grid_button_style_hover', [ 'label' => __( 'Hover', 'aronia' ), ] ); // Hover background color. $this->add_control( 'grid_button_style_hover_bg_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Background Color', 'aronia' ), 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'separator' => '', 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post:hover' => 'background-color: {{VALUE}};', ], ] ); // Hover border color. $this->add_control( 'grid_button_style_hover_border_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Border Color', 'aronia' ), 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'separator' => '', 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post:hover' => 'border-color: {{VALUE}};', ], ] ); // Hover box shadow. $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'grid_button_style_hover_box_shadow', 'selector' => '{{WRAPPER}} .wpcap-grid-container .wpcap-post:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Style Image Options. */ private function wpcap_style_image_options() { // Box. $this->start_controls_section( 'section_image', [ 'label' => __( 'Image', 'aronia' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); // Image border radius. $this->add_control( 'grid_image_border_radius', [ 'label' => __( 'Border Radius', 'aronia' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .post-grid-inner .post-grid-thumbnail img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'grid_style_image_margin', [ 'label' => __( 'Margin', 'aronia' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .post-grid-inner .post-grid-thumbnail' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Style > Title. */ private function wpcap_style_title_options() { // Tab. $this->start_controls_section( 'section_grid_title_style', [ 'label' => __( 'Title', 'aronia' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); // Title typography. $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'grid_title_style_typography', 'scheme' => Scheme_Typography::TYPOGRAPHY_1, 'selector' => '{{WRAPPER}} .wpcap-grid-container .wpcap-post .title, {{WRAPPER}} .wpcap-grid-container .wpcap-post .title > a', ] ); // Title color. $this->add_control( 'grid_title_style_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Color', 'aronia' ), 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post .title, {{WRAPPER}} .wpcap-grid-container .wpcap-post .title > a' => 'color: {{VALUE}};', ], ] ); // Title margin. $this->add_responsive_control( 'grid_title_style_margin', [ 'label' => __( 'Margin', 'aronia' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post .title, {{WRAPPER}} .wpcap-grid-container .wpcap-post .title > a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Style > Meta. */ private function wpcap_style_meta_options() { // Tab. $this->start_controls_section( 'section_grid_meta_style', [ 'label' => __( 'Meta', 'aronia' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); // Meta typography. $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'grid_meta_style_typography', 'scheme' => Scheme_Typography::TYPOGRAPHY_1, 'selector' => '{{WRAPPER}} .wpcap-grid-container .wpcap-post .post-grid-meta span', ] ); // Meta color. $this->add_control( 'grid_meta_style_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Color', 'aronia' ), 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post .post-grid-meta span' => 'color: {{VALUE}};', '{{WRAPPER}} .wpcap-grid-container .wpcap-post .post-grid-meta span a' => 'color: {{VALUE}};', ], ] ); // Meta margin. $this->add_responsive_control( 'grid_meta_style_margin', [ 'label' => __( 'Margin', 'aronia' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post .post-grid-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Style > Content. */ private function wpcap_style_content_options() { // Tab. $this->start_controls_section( 'section_grid_content_style', [ 'label' => __( 'Content', 'aronia' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); // Content typography. $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'grid_content_style_typography', 'scheme' => Scheme_Typography::TYPOGRAPHY_1, 'selector' => '{{WRAPPER}} .wpcap-grid-container .wpcap-post .post-grid-excerpt p', ] ); // Content color. $this->add_control( 'grid_content_style_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Color', 'aronia' ), 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post .post-grid-excerpt p' => 'color: {{VALUE}};', ], ] ); // Content margin $this->add_responsive_control( 'grid_content_style_margin', [ 'label' => __( 'Margin', 'aronia' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post .post-grid-excerpt' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Style > Readmore. */ private function wpcap_style_readmore_options() { // Tab. $this->start_controls_section( 'section_grid_readmore_style', [ 'label' => __( 'Read More', 'aronia' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); // Readmore typography. $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'grid_readmore_style_typography', 'scheme' => Scheme_Typography::TYPOGRAPHY_1, 'selector' => '{{WRAPPER}} .wpcap-grid-container .wpcap-post a.read-more-btn', ] ); // Readmore color. $this->add_control( 'grid_readmore_style_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Color', 'aronia' ), 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post a.read-more-btn' => 'color: {{VALUE}};', ], ] ); // Readmore margin $this->add_responsive_control( 'grid_readmore_style_margin', [ 'label' => __( 'Margin', 'aronia' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .wpcap-grid-container .wpcap-post a.read-more-btn' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } protected function render( $instance = [] ) { // Get settings. $settings = $this->get_settings(); ?>