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.php
<?php namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Quarty Portfolio Widget. * * @since 1.0 */ class Quarty_Portfolio_Widget extends Widget_Base { public function get_name() { return 'quarty-portfolio'; } public function get_title() { return esc_html__( 'Portfolio', '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->add_control( 'title_show', [ 'label' => esc_html__( 'Show Title', 'quarty-plugin' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'quarty-plugin' ), 'label_off' => __( 'Hide', 'quarty-plugin' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->end_controls_section(); $this->start_controls_section( 'filters_tab', [ 'label' => esc_html__( 'Filters', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'filters_note', [ 'type' => \Elementor\Controls_Manager::RAW_HTML, 'raw' => esc_html__( 'Filters show only with pagination "Button" or "No"', 'quarty-plugin' ), 'content_classes' => 'elementor-descriptor', ] ); $this->add_control( 'filters', [ 'label' => esc_html__( 'Show Filters', 'quarty-plugin' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'quarty-plugin' ), 'label_off' => __( 'Hide', 'quarty-plugin' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $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( 'pagination_tab', [ 'label' => esc_html__( 'Pagination', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'pagination', [ 'label' => esc_html__( 'Pagination', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT, 'default' => 'no', 'options' => [ 'no' => __( 'No', 'quarty-plugin' ), 'pages' => __( 'Pages', 'quarty-plugin' ), 'button' => __( 'Button', 'quarty-plugin' ), ], ] ); $this->add_control( 'more_btn_txt', [ 'label' => esc_html__( 'Button (title)', 'quarty-plugin' ), 'type' => Controls_Manager::TEXT, 'placeholder' => esc_html__( 'Enter button', 'quarty-plugin' ), 'default' => esc_html__( 'All Posts', 'quarty-plugin' ), 'condition' => [ 'pagination' => 'button' ], ] ); $this->add_control( 'more_btn_link', [ 'label' => esc_html__( 'Button (link)', 'quarty-plugin' ), 'type' => Controls_Manager::URL, 'show_external' => true, 'condition' => [ 'pagination' => 'button' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'settings_tab', [ 'label' => esc_html__( 'Settings', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'layout', [ 'label' => esc_html__( 'Layout', 'quarty-plugin' ), 'type' => Controls_Manager::SELECT, 'default' => 'column-2', 'options' => [ 'column-1' => __( '1 Columns', 'quarty-plugin' ), 'column-2' => __( '2 Columns', 'quarty-plugin' ), 'column-3' => __( '3 Columns', 'quarty-plugin' ), 'column-4' => __( '4 Columns', 'quarty-plugin' ), ], ] ); $this->add_control( 'masonry', [ 'label' => esc_html__( 'Masonry Grid', 'quarty-plugin' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Enable', 'quarty-plugin' ), 'label_off' => __( 'Disable', 'quarty-plugin' ), 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_control( 'show_item_details', [ 'label' => esc_html__( 'Show Item Details?', 'quarty-plugin' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'quarty-plugin' ), 'label_off' => __( 'Hide', 'quarty-plugin' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'show_item_name', [ 'label' => esc_html__( 'Show Item Name?', 'quarty-plugin' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'quarty-plugin' ), 'label_off' => __( 'Hide', 'quarty-plugin' ), 'return_value' => 'yes', 'default' => 'yes', 'condition' => [ 'show_item_details' => 'yes' ], ] ); $this->add_control( 'show_item_link', [ 'label' => esc_html__( 'Show Item Link?', 'quarty-plugin' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'quarty-plugin' ), 'label_off' => __( 'Hide', 'quarty-plugin' ), 'return_value' => 'yes', 'default' => 'yes', 'condition' => [ 'show_item_details' => 'yes' ], ] ); $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( 'filters_styling', [ 'label' => esc_html__( 'Filters', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'filters_color', [ 'label' => esc_html__( 'Link Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-filter a' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'filters_bg_color', [ 'label' => esc_html__( 'Link BG Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-filter a' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'filters_typography', 'selector' => '{{WRAPPER}} .qrt-filter a', ] ); $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(); $this->start_controls_section( 'pagination_styling', [ 'label' => esc_html__( 'Pagination', 'quarty-plugin' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'pagination_color', [ 'label' => esc_html__( 'Color', 'quarty-plugin' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .qrt-blog-pagination a' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'pagination_typography', 'selector' => '{{WRAPPER}} .qrt-blog-pagination', ] ); $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' => 'ASC', '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' ); $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $page_id = get_the_ID(); 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 ); $pf_categories = get_categories( $cat_args ); $args = array( 'post_type' => 'portfolio', 'post_status' => 'publish', 'orderby' => $settings['sort'], 'order' => $settings['order'], 'posts_per_page' => $settings['limit'], 'paged' => $paged ); 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 qrt-section-sf"> <?php if ( $settings['title'] && $settings['title_show'] == 'yes' ) : ?> <div class="row"> <div class="col-lg-12"> <<?php echo esc_attr( $settings['title_tag'] ); ?> class="qrt-mb-40 qrt-title-h"> <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> </div> <?php endif; ?> <?php if ( $settings['filters'] && $pf_categories && $settings['pagination'] != 'pages' ) : ?> <div class="qrt-filter qrt-mb-40"> <a href="#" data-filter="*" class="qrt-work-category qrt-current qrt-filter-icon qrt-cursor-color qrt-cursor-scale"><i class="fas fa-filter"></i><?php echo esc_html__( 'All Categories', 'quarty-plugin' ); ?></a> <?php foreach ( $pf_categories as $category ) : ?> <a href="#" data-filter=".category-<?php echo esc_attr( $category->slug ); ?>" class="qrt-work-category qrt-cursor-color qrt-cursor-scale"><?php echo esc_html( $category->name ); ?></a> <?php endforeach; ?> </div> <?php endif; ?> <?php if ( $q->have_posts() ) : ?> <div class="qrt-masonry-grid qrt-mb-40<?php if ( $settings['layout'] == 'column-1' ) : ?> qrt-grid-1-col<?php endif; ?><?php if ( $settings['layout'] == 'column-2' ) : ?> qrt-grid-2-col<?php endif; ?><?php if ( $settings['layout'] == 'column-3' ) : ?> qrt-grid-3-col<?php endif; ?><?php if ( $settings['layout'] == 'column-4' ) : ?> qrt-grid-4-col<?php endif; ?> qrt-gallery<?php if ( $settings['masonry'] == 'yes' ) : ?> qrt-grid-masonry<?php endif; ?><?php if ( $settings['show_item_details'] != 'yes' ) : ?> qrt-grid-hide-details<?php endif; ?><?php if ( $settings['show_item_name'] != 'yes' ) : ?> qrt-grid-hide-name<?php endif; ?><?php if ( $settings['show_item_link'] != 'yes' ) : ?> qrt-grid-hide-link<?php endif; ?>"> <div class="qrt-grid-sizer"></div> <?php while ( $q->have_posts() ) : $q->the_post(); ?> <?php get_template_part( 'template-parts/content', 'portfolio' ); ?> <?php endwhile; ?> </div> <?php else : get_template_part( 'template-parts/content', 'none' ); endif; wp_reset_postdata(); ?> <?php if ( $settings['pagination'] == 'pages' ) : ?> <div class="pagination qrt-blog-pagination"> <?php $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $q->max_num_pages, 'prev_text' => esc_html__( 'Prev', 'quarty-plugin' ), 'next_text' => esc_html__( 'Next', 'quarty-plugin' ), ) ); ?> </div> <?php endif; ?> <?php if ( $settings['pagination'] == 'button' && $settings['more_btn_link'] ) : ?> <div class="qrt-bts text-center"> <a class="qrt-btn qrt-btn-md qrt-btn-color qrt-anima-link" href="<?php echo esc_url( $settings['more_btn_link']['url'] ); ?>"<?php if ( $settings['more_btn_link']['is_external'] ) : ?> target="_blank"<?php endif; ?><?php if ( $settings['more_btn_link']['nofollow'] ) : ?> rel="nofollow"<?php endif; ?>><span><?php echo esc_html( $settings['more_btn_txt'] ); ?></span></a> </div> <?php endif; ?> </div> <?php } } Plugin::instance()->widgets_manager->register_widget_type( new Quarty_Portfolio_Widget() );
Save Changes
Rename File
Rename