File Editor
Directories:
.. (Back)
Files:
about-banner.php
about-resume.php
about-us.php
blog-carousel.php
blog-grid.php
clients.php
contact-form.php
contact-information.php
contact-map.php
cta.php
hero-image.php
hero-slider.php
numbers.php
portfolio-carousel.php
portfolio.php
pricing.php
project-image-gallery.php
project-image.php
resume.php
services.php
team.php
testimonials.php
Create New File
Create
Edit File: portfolio-carousel.php
<?php namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Quarty Portfolio Widget. * * @since 1.0 */ class Quarty_Portfolio_Carousel_Widget extends Widget_Base { public function get_name() { return 'quarty-portfolio-carousel'; } public function get_title() { return esc_html__( 'Portfolio Carousel', 'quarty-plugin' ); } public function get_icon() { return 'fas fa-suitcase'; } public function get_categories() { return [ 'quarty-category' ]; } /** * Register widget controls. * * @since 1.0 */ protected function register_controls() { $this->start_controls_section( 'heading_tab', [ 'label' => esc_html__( 'Title', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'title', [ 'label' => esc_html__( 'Title', 'quarty-plugin' ), 'type' => Controls_Manager::TEXTAREA, 'placeholder' => esc_html__( 'Enter title', 'quarty-plugin' ), 'default' => esc_html__( 'Title', 'quarty-plugin' ), ] ); $this->add_control( 'title_tag', [ 'label' => esc_html__( 'Title Tag', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT, 'default' => 'h3', 'options' => [ 'h1' => __( 'H1', 'quarty-plugin' ), 'h2' => __( 'H2', 'quarty-plugin' ), 'h3' => __( 'H3', 'quarty-plugin' ), 'h4' => __( 'H4', 'quarty-plugin' ), 'div' => __( 'DIV', 'quarty-plugin' ), ], ] ); $this->end_controls_section(); $this->start_controls_section( 'items_tab', [ 'label' => esc_html__( 'Items', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'source', [ 'label' => esc_html__( 'Source', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT, 'default' => 'all', 'options' => [ 'all' => __( 'All', 'quarty-plugin' ), 'categories' => __( 'Categories', 'quarty-plugin' ), ], ] ); $this->add_control( 'source_categories', [ 'label' => esc_html__( 'Source', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => $this->get_portfolio_categories(), 'condition' => [ 'source' => 'categories' ], ] ); $this->add_control( 'limit', [ 'label' => esc_html__( 'Number of Items', 'quarty-plugin' ), 'type' => Controls_Manager::NUMBER, 'placeholder' => 8, 'default' => 8, ] ); $this->add_control( 'sort', [ 'label' => esc_html__( 'Sorting By', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT, 'default' => 'menu_order', 'options' => [ 'date' => __( 'Date', 'quarty-plugin' ), 'title' => __( 'Title', 'quarty-plugin' ), 'rand' => __( 'Random', 'quarty-plugin' ), 'menu_order' => __( 'Order', 'quarty-plugin' ), ], ] ); $this->add_control( 'order', [ 'label' => esc_html__( 'Order', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT, 'default' => 'asc', 'options' => [ 'asc' => __( 'ASC', 'quarty-plugin' ), 'desc' => __( 'DESC', 'quarty-plugin' ), ], ] ); $this->end_controls_section(); $this->start_controls_section( 'title_styling', [ 'label' => esc_html__( 'Title', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-section .qrt-title-h' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .qrt-section .qrt-title-h', ] ); $this->end_controls_section(); $this->start_controls_section( 'items_styling', [ 'label' => esc_html__( 'Items', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'item_bg', [ 'label' => esc_html__( 'Item BG Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-work-item .qrt-work-descr, {{WRAPPER}} .qrt-work-item .qrt-work-cover-frame .qrt-item-zoom' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'item_title_color', [ 'label' => esc_html__( 'Title Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-work-item h4' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'item_title_typography', 'label' => esc_html__( 'Title Typography', 'quarty-plugin' ), 'selector' => '{{WRAPPER}} .qrt-work-item h4', ] ); $this->add_control( 'item_btn_color', [ 'label' => esc_html__( 'Button Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-work-item .qrt-work-descr .qrt-work-more' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'item_btn_bg_color', [ 'label' => esc_html__( 'Button BG Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-work-item .qrt-work-descr .qrt-work-more' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_section(); } /** * Render Categories List. * * @since 1.0 */ protected function get_portfolio_categories() { $categories = []; $args = array( 'type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'DESC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => 'portfolio_categories', 'pad_counts' => false ); $portfolio_categories = get_categories( $args ); foreach ( $portfolio_categories as $category ) { $categories[$category->term_id] = $category->name; } return $categories; } /** * Render widget output on the frontend. * * @since 1.0 */ protected function render() { $settings = $this->get_settings_for_display(); $this->add_inline_editing_attributes( 'title', 'basic' ); if ( $settings['source'] == 'all' ) { $cat_ids = ''; } else { $cat_ids = $settings['source_categories']; } $cat_args = array( 'type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'DESC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => 'portfolio_categories', 'pad_counts' => false, 'include' => $cat_ids ); $args = array( 'post_type' => 'portfolio', 'post_status' => 'publish', 'orderby' => $settings['sort'], 'order' => $settings['order'], 'posts_per_page' => $settings['limit'], 'paged' => 1 ); if( $settings['source'] == 'categories' ) { $tax_array = array( array( 'taxonomy' => 'portfolio_categories', 'field' => 'id', 'terms' => $cat_ids ) ); $args += array('tax_query' => $tax_array); } $q = new \WP_Query( $args ); ?> <div class="qrt-section"> <div class="row"> <?php if ( $settings['title'] ) : ?> <div class="col-lg-12"> <<?php echo esc_attr( $settings['title_tag'] ); ?> class="qrt-title-h qrt-mb-40"> <span <?php echo $this->get_render_attribute_string( 'title' ); ?>> <?php echo wp_kses_post( $settings['title'] ); ?> </span> </<?php echo esc_attr( $settings['title_tag'] ); ?>> </div> <?php endif; ?> <?php if ( $q->have_posts() ) : ?> <div class="col-lg-12"> <div class="swiper-container qrt-latest-works-slider qrt-mb-20" style="overflow: visible"> <div class="swiper-wrapper"> <?php while ( $q->have_posts() ) : $q->the_post(); ?> <div class="swiper-slide"> <?php get_template_part( 'template-parts/content', 'portfolio-carousel' ); ?> </div> <?php endwhile; ?> </div> </div> </div> <div class="col-6"> <div class="swiper-latest-works-pagination"></div> </div> <div class="col-6"> <div class="qrt-slider-nav"> <!-- prev --> <div class="qrt-slider-prev qrt-latest-works-prev"><i class="fas fa-arrow-left"></i></div> <!-- next --> <div class="qrt-slider-next qrt-latest-works-next"><i class="fas fa-arrow-right"></i></div> </div> </div> <?php endif; wp_reset_postdata(); ?> </div> </div> <?php } } Plugin::instance()->widgets_manager->register_widget_type( new Quarty_Portfolio_Carousel_Widget() );
Save Changes
Rename File
Rename