WP init
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\ArchiveTitle;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-archive-title';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Archive_Title', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+458
@@ -0,0 +1,458 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\ArchiveTitle\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Text_Shadow;
|
||||
use Elementor\Group_Control_Text_Stroke;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Wpr_Archive_Title extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-archive-title';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Archive Title/Desc', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-site-title';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
if ( Utilities::show_theme_buider_widget_on('archive') ) {
|
||||
return [ 'wpr-theme-builder-widgets' ];
|
||||
} elseif ( Utilities::show_theme_buider_widget_on('product_archive') ) {
|
||||
return [ 'wpr-woocommerce-builder-widgets' ];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'archive', 'title', 'description', 'category', 'tag' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
public function add_control_archive_description() {}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_post_title',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'post_title_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'center',
|
||||
'label_block' => false,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => __( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => __( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => __( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors_dictionary' => [
|
||||
'left' => 'text-align: left;',
|
||||
'center' => 'text-align: center; margin: 0 auto;',
|
||||
'right' => 'text-align: right; margin-left: auto;',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title' => '{{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-archive-title:after' => '{{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-archive-description' => '{{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_title_tag',
|
||||
[
|
||||
'label' => esc_html__( 'Title HTML Tag', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'h1' => 'H1',
|
||||
'h2' => 'H2',
|
||||
'h3' => 'H3',
|
||||
'h4' => 'H4',
|
||||
'h5' => 'H5',
|
||||
'h6' => 'H6',
|
||||
'div' => 'div',
|
||||
'span' => 'span',
|
||||
'P' => 'p'
|
||||
],
|
||||
'default' => 'h1',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_title_before_text',
|
||||
[
|
||||
'label' => esc_html__( 'Text Before Title', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'default' => '',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control_archive_description();
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
|
||||
|
||||
// Section: Pro Features
|
||||
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'archive-title', [
|
||||
'Show/Hide Taxonomy (Category) Description, also change Color and Typography.',
|
||||
] );
|
||||
|
||||
// Styles ====================
|
||||
// Section: Title ------------
|
||||
$this->start_controls_section(
|
||||
'section_style_title',
|
||||
[
|
||||
'label' => esc_html__( 'Title & Description', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#333333',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_before_text_color',
|
||||
[
|
||||
'label' => esc_html__( 'Before Text Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#555555',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title span' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '24',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
],
|
||||
'selector' => '{{WRAPPER}} .wpr-archive-title'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Text_Stroke::get_type(),
|
||||
[
|
||||
'name' => 'text_stroke',
|
||||
'selector' => '{{WRAPPER}} .wpr-archive-title',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Text_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'title_shadow',
|
||||
'selector' => '{{WRAPPER}} .wpr-archive-title',
|
||||
'separator' => 'after',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'blend_mode',
|
||||
[
|
||||
'label' => esc_html__( 'Blend Mode', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'' => esc_html__( 'Normal', 'wpr-addons' ),
|
||||
'multiply' => 'Multiply',
|
||||
'screen' => 'Screen',
|
||||
'overlay' => 'Overlay',
|
||||
'darken' => 'Darken',
|
||||
'lighten' => 'Lighten',
|
||||
'color-dodge' => 'Color Dodge',
|
||||
'saturation' => 'Saturation',
|
||||
'color' => 'Color',
|
||||
'difference' => 'Difference',
|
||||
'exclusion' => 'Exclusion',
|
||||
'hue' => 'Hue',
|
||||
'luminosity' => 'Luminosity',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title' => 'mix-blend-mode: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_desc_heading',
|
||||
[
|
||||
'label' => esc_html__( 'Description', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'archive_description' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'desc_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#666666',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-description' => 'color: {{VALUE}}',
|
||||
],
|
||||
'condition' => [
|
||||
'archive_description' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'desc_typography',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '14',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
],
|
||||
'selector' => '{{WRAPPER}} .wpr-archive-description',
|
||||
'condition' => [
|
||||
'archive_description' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_divider_heading',
|
||||
[
|
||||
'label' => esc_html__( 'Divider', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_divider_show',
|
||||
[
|
||||
'label' => esc_html__( 'Show Divider', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
'return_value' => 'yes',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_divider_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#e8e8e8',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title:after' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'title_divider_show' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_divider_height',
|
||||
[
|
||||
'label' => esc_html__( 'Height', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 1,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title:after' => 'height: {{SIZE}}px;',
|
||||
],
|
||||
'condition' => [
|
||||
'title_divider_show' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_divider_width',
|
||||
[
|
||||
'label' => esc_html__( 'Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ '%', 'px' ],
|
||||
'range' => [
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 300,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 100,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title:after' => 'width: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'title_divider_show' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_divider_distance_top',
|
||||
[
|
||||
'label' => esc_html__( 'Top Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 7,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 25,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title:after' => 'margin-top: {{SIZE}}px;',
|
||||
],
|
||||
'condition' => [
|
||||
'title_divider_show' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_divider_distance_bot',
|
||||
[
|
||||
'label' => esc_html__( 'Bottom Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 5,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 25,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-archive-title:after' => 'margin-bottom: {{SIZE}}px;',
|
||||
],
|
||||
'condition' => [
|
||||
'title_divider_show' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
// Get Settings
|
||||
$settings = $this->get_settings();
|
||||
$tax = get_queried_object();
|
||||
|
||||
$tags_whitelist = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p'];
|
||||
$post_title_tag = Utilities::validate_html_tags_wl( $settings['post_title_tag'], 'h1', $tags_whitelist );
|
||||
|
||||
if ( is_search() ) {
|
||||
echo '<'. esc_attr($post_title_tag) .' class="wpr-archive-title">';
|
||||
echo '<span>'. esc_html($settings['post_title_before_text']) .'</span>'. esc_html(get_search_query());
|
||||
echo '</'. esc_attr($post_title_tag) .'>';
|
||||
} elseif ( !is_null($tax) ) {
|
||||
$title = isset($tax->post_title) ? $tax->post_title : $tax->name;
|
||||
$description = isset($tax->description) ? $tax->description : '';
|
||||
|
||||
if ( function_exists('is_shop') && is_shop() ) {
|
||||
$title = $tax->label;
|
||||
}
|
||||
|
||||
if ( '' !== $title ) {
|
||||
echo '<'. esc_attr($post_title_tag) .' class="wpr-archive-title">';
|
||||
echo '<span>'. wp_kses_post($settings['post_title_before_text']) .'</span>'. esc_html($title);
|
||||
echo '</'. esc_attr($post_title_tag) .'>';
|
||||
}
|
||||
|
||||
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() ) {
|
||||
if ( '' !== $description && '' !== $settings['archive_description'] ) {
|
||||
echo '<p class="wpr-archive-description">'. wp_kses_post($description) .'</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\AuthorBox;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
use wpraddons\Classes\Utilities;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-author-box';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Author_Box', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+900
@@ -0,0 +1,900 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\AuthorBox\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Box_Shadow;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use Elementor\Group_Control_Border;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Wpr_Author_Box extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-author-box';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Author Box', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-person';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('single') || Utilities::show_theme_buider_widget_on('archive') ? [ 'wpr-theme-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'author', 'box', 'post', ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
public function add_controls_group_author_name_links_to() {
|
||||
$this->add_control(
|
||||
'author_name_links_to',
|
||||
[
|
||||
'label' => esc_html__( 'Links To', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'Nothing', 'wpr-addons' ),
|
||||
'posts' => esc_html__( 'Author Posts', 'wpr-addons' ),
|
||||
'pro-ws' => esc_html__( 'Website (Pro)', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'none',
|
||||
'condition' => [
|
||||
'author_name' => 'yes',
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function add_controls_group_author_title_links_to() {
|
||||
$this->add_control(
|
||||
'author_title_links_to',
|
||||
[
|
||||
'label' => esc_html__( 'Links To', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'Nothing', 'wpr-addons' ),
|
||||
'posts' => esc_html__( 'Author Posts', 'wpr-addons' ),
|
||||
'pro-ws' => esc_html__( 'Website (Pro)', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'none',
|
||||
'condition' => [
|
||||
'author_title' => 'yes',
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function add_control_author_bio() {}
|
||||
|
||||
public function add_section_style_bio() {}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_author_box',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'author_arrange',
|
||||
[
|
||||
'label' => esc_html__( 'Arrange', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => false,
|
||||
'default' => 'vertical',
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-h-align-left',
|
||||
],
|
||||
'vertical' => [
|
||||
'title' => esc_html__( 'Vertical', 'wpr-addons' ),
|
||||
'icon' => 'eicon-v-align-top',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-h-align-right',
|
||||
],
|
||||
],
|
||||
'prefix_class' => 'wpr-author-box-arrange-'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'author_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => false,
|
||||
'default' => 'center',
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box' => 'text-align: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'author_avatar',
|
||||
[
|
||||
'label' => esc_html__( 'Show Avatar', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
'return_value' => 'yes',
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'author_name',
|
||||
[
|
||||
'label' => esc_html__( 'Show Name', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
'return_value' => 'yes',
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'author_name_tag',
|
||||
[
|
||||
'label' => esc_html__( 'Name HTML Tag', 'wpr-addons' ),
|
||||
'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' => [
|
||||
'author_name' => 'yes',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_controls_group_author_name_links_to();
|
||||
|
||||
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'author-box', 'author_name_links_to', ['pro-ws'] );
|
||||
|
||||
$this->add_control(
|
||||
'author_title',
|
||||
[
|
||||
'label' => esc_html__( 'Show Title', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
'return_value' => 'yes',
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'author_title_text',
|
||||
[
|
||||
'label' => esc_html__( 'Title', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'default' => 'Writer & Blogger',
|
||||
'condition' => [
|
||||
'author_title' => 'yes',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'author_title_tag',
|
||||
[
|
||||
'label' => esc_html__( 'Title HTML Tag', 'wpr-addons' ),
|
||||
'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' => [
|
||||
'author_title' => 'yes',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_controls_group_author_title_links_to();
|
||||
|
||||
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'author-box', 'author_title_links_to', ['pro-ws'] );
|
||||
|
||||
$this->add_control_author_bio();
|
||||
|
||||
$this->add_control(
|
||||
'author_posts_link',
|
||||
[
|
||||
'label' => esc_html__( 'Show Author Posts Link', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'return_value' => 'yes',
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'author_posts_link_text',
|
||||
[
|
||||
'label' => esc_html__( 'Posts Link Text', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'default' => 'All Posts',
|
||||
'condition' => [
|
||||
'author_posts_link' => [ 'yes' ],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
|
||||
|
||||
// Section: Pro Features
|
||||
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'author-box', [
|
||||
'Link to Author Website.',
|
||||
'Show/Hide Author Biography (description).'
|
||||
] );
|
||||
|
||||
// Styles ====================
|
||||
// Section: Avatar -----------
|
||||
$this->start_controls_section(
|
||||
'section_style_avatar',
|
||||
[
|
||||
'label' => esc_html__( 'Avatar', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'avatar_align',
|
||||
[
|
||||
'label' => esc_html__( 'Center Image Vertically', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'return_value' => 'yes',
|
||||
'selectors_dictionary' => [
|
||||
'' => '',
|
||||
'yes' => 'align-self: center;',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-image' => '{{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'avatar_size',
|
||||
[
|
||||
'label' => esc_html__( 'Image Size', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 65,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 16,
|
||||
'max' => 300,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-image img' => 'width: {{SIZE}}px',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'avatar_distance',
|
||||
[
|
||||
'label' => esc_html__( 'Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.wpr-author-box-arrange-vertical .wpr-author-box-image' => 'margin-bottom: {{SIZE}}px',
|
||||
'{{WRAPPER}}.wpr-author-box-arrange-left .wpr-author-box-image' => 'margin-right: {{SIZE}}px',
|
||||
'{{WRAPPER}}.wpr-author-box-arrange-right .wpr-author-box-image' => 'margin-left: {{SIZE}}px',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Border::get_type(),
|
||||
[
|
||||
'name' => 'avatar_border',
|
||||
'fields_options' => [
|
||||
'border' => [
|
||||
'default' => '',
|
||||
],
|
||||
'width' => [
|
||||
'default' => [
|
||||
'top' => '1',
|
||||
'right' => '1',
|
||||
'bottom' => '1',
|
||||
'left' => '1',
|
||||
'isLinked' => true,
|
||||
],
|
||||
],
|
||||
'color' => [
|
||||
'default' => '#222222',
|
||||
],
|
||||
],
|
||||
'selector' => '{{WRAPPER}} .wpr-author-box-image img',
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'avatar_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 50,
|
||||
'right' => 50,
|
||||
'bottom' => 50,
|
||||
'left' => 50,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'avatar_shadow',
|
||||
'selector' => '{{WRAPPER}} .wpr-author-box-image',
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Styles ====================
|
||||
// Section: Name -------------
|
||||
$this->start_controls_section(
|
||||
'section_style_name',
|
||||
[
|
||||
'label' => esc_html__( 'Name', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'name_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-name' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-author-box-name a' => 'color: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'after',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'name_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-author-box-name',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_weight' => [
|
||||
'default' => '500',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '18',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
'letter_spacing' => [
|
||||
'default' => [
|
||||
'size' => '0.2'
|
||||
]
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'name_top_distance',
|
||||
[
|
||||
'label' => esc_html__( 'Top Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 15,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-name' => 'margin-top: {{SIZE}}px',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'name_bot_distance',
|
||||
[
|
||||
'label' => esc_html__( 'Bottom Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 10,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-name' => 'margin-bottom: {{SIZE}}px',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Styles ====================
|
||||
// Section: Title -------------
|
||||
$this->start_controls_section(
|
||||
'section_style_title',
|
||||
[
|
||||
'label' => esc_html__( 'Title', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#333333',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-title' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-author-box-title a' => 'color: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'after',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-author-box-title',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_weight' => [
|
||||
'default' => '500',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '15',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_top_distance',
|
||||
[
|
||||
'label' => esc_html__( 'Top Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 15,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-title' => 'margin-top: {{SIZE}}px',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'title_bot_distance',
|
||||
[
|
||||
'label' => esc_html__( 'Bottom Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 15,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-title' => 'margin-bottom: {{SIZE}}px',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Styles ====================
|
||||
// Section: Biography --------
|
||||
$this->add_section_style_bio();
|
||||
|
||||
// Styles ====================
|
||||
// Section: Author Posts Link
|
||||
$this->start_controls_section(
|
||||
'section_style_archive_link',
|
||||
[
|
||||
'label' => esc_html__( 'Author Posts Link', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->start_controls_tabs( 'tabs_grid_archive_link_style' );
|
||||
|
||||
$this->start_controls_tab(
|
||||
'tab_grid_archive_link_normal',
|
||||
[
|
||||
'label' => esc_html__( 'Normal', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ffffff',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_bg_color',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn' => 'background-color: {{VALUE}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_border_color',
|
||||
[
|
||||
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn' => 'border-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'archive_link_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-author-box-btn'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_transition_duration',
|
||||
[
|
||||
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 0.1,
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
'step' => 0.1,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn' => 'transition-duration: {{VALUE}}s',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->start_controls_tab(
|
||||
'tab_grid_archive_link_hover',
|
||||
[
|
||||
'label' => esc_html__( 'Hover', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ffffff',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn:hover' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-author-box-btn:hover a' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_bg_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn:hover' => 'background-color: {{VALUE}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_border_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn:hover' => 'border-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->end_controls_tabs();
|
||||
|
||||
$this->add_responsive_control(
|
||||
'archive_link_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 5,
|
||||
'right' => 15,
|
||||
'bottom' => 5,
|
||||
'left' => 15,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_border_type',
|
||||
[
|
||||
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
|
||||
'double' => esc_html__( 'Double', 'wpr-addons' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
|
||||
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'none',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn' => 'border-style: {{VALUE}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_border_width',
|
||||
[
|
||||
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 1,
|
||||
'right' => 1,
|
||||
'bottom' => 1,
|
||||
'left' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'archive_link_border_type!' => 'none',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'archive_link_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => 3,
|
||||
'right' => 3,
|
||||
'bottom' => 3,
|
||||
'left' => 3,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-author-box-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
// Get Settings
|
||||
$settings = $this->get_settings();
|
||||
|
||||
if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) {
|
||||
$settings['author_bio'] = '';
|
||||
$settings['author_name_link_tab'] = '';
|
||||
$settings['author_title_link_tab'] = '';
|
||||
}
|
||||
|
||||
// Get Author Info
|
||||
$id = get_the_author_meta( 'ID' );
|
||||
$avatar = get_avatar( $id, 264 );
|
||||
$name = get_the_author_meta( 'display_name' );
|
||||
$title = $settings['author_title_text'];
|
||||
$biography = get_the_author_meta( 'description' );
|
||||
$website = get_the_author_meta( 'user_url' );
|
||||
$archive_url = get_author_posts_url( $id );
|
||||
$author_name_link = 'website' === $settings['author_name_links_to'] ? $website : $archive_url;
|
||||
$author_name_target = 'yes' === $settings['author_name_link_tab'] ? '_blank' : '_self';
|
||||
$author_name_has_website = 'website' === $settings['author_name_links_to'] && '' !== $website ? true : false;
|
||||
$author_title_link = 'website' === $settings['author_title_links_to'] ? $website : $archive_url;
|
||||
$author_title_target = 'yes' === $settings['author_title_link_tab'] ? '_blank' : '_self';
|
||||
$author_title_has_website = 'website' === $settings['author_title_links_to'] && '' !== $website ? true : false;
|
||||
$tags_whitelist = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p'];
|
||||
|
||||
// HTML
|
||||
echo '<div class="wpr-author-box">';
|
||||
|
||||
// Avatar
|
||||
if ( '' !== $settings['author_avatar'] && false !== $avatar ) {
|
||||
echo '<div class="wpr-author-box-image">';
|
||||
if ( 'posts' === $settings['author_name_links_to'] || $author_name_has_website ) {
|
||||
echo '<a href="'. esc_url( $author_name_link ) .'" target="'. esc_attr($author_name_target) .'">'. wp_kses_post($avatar) .'</a>';
|
||||
} else {
|
||||
echo wp_kses_post($avatar);
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// Wrap All Text Blocks
|
||||
echo '<div class="wpr-author-box-text">';
|
||||
|
||||
// Author Name
|
||||
if ( '' !== $settings['author_name'] && '' !== $name ) {
|
||||
$author_name_tag = Utilities::validate_html_tags_wl( $settings['author_name_tag'], 'h3', $tags_whitelist );
|
||||
|
||||
echo '<'. esc_attr($author_name_tag) .' class="wpr-author-box-name">';
|
||||
if ( 'posts' === $settings['author_name_links_to'] || $author_name_has_website ) {
|
||||
echo '<a href="'. esc_url( $author_name_link ) .'" target="'. esc_attr($author_name_target) .'">'. esc_html($name) .'</a>';
|
||||
} else {
|
||||
echo esc_html($name);
|
||||
}
|
||||
echo '</'. esc_attr($author_name_tag) .'>';
|
||||
}
|
||||
|
||||
// Author Title
|
||||
if ( '' !== $title && 'yes' === $settings['author_title'] ) {
|
||||
$author_title_tag = Utilities::validate_html_tags_wl( $settings['author_title_tag'], 'h3', $tags_whitelist );
|
||||
|
||||
echo '<'. esc_attr($author_title_tag) .' class="wpr-author-box-title">';
|
||||
if ( 'posts' === $settings['author_title_links_to'] || $author_title_has_website ) {
|
||||
echo '<a href="'. esc_url( $author_title_link ) .'" target="'. esc_attr($author_title_target) .'">'. wp_kses_post($title) .'</a>';
|
||||
} else {
|
||||
echo wp_kses_post($title);
|
||||
}
|
||||
echo '</'. esc_attr($author_title_tag) .'>';
|
||||
}
|
||||
|
||||
// Author Biography
|
||||
if ( '' !== $settings['author_bio'] && '' !== $biography ) {
|
||||
echo '<p class="wpr-author-box-bio">'. wp_kses_post($biography) .'</p>';
|
||||
}
|
||||
|
||||
// Author Posts Link
|
||||
if ( '' !== $settings['author_posts_link'] ) {
|
||||
echo '<a href="'. esc_url( $archive_url ) .'" class="wpr-author-box-btn">';
|
||||
echo esc_html( $settings['author_posts_link_text'] );
|
||||
echo '</a>';
|
||||
}
|
||||
|
||||
echo '</div>'; // End .wpr-author-box-text
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostComments;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-comments';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Post_Comments', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+2463
File diff suppressed because it is too large
Load Diff
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostContent;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-content';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Post_Content', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostContent\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Wpr_Post_Content extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-content';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Post Content', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-post-content';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('single') ? [ 'wpr-theme-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'post', 'content' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_post_content',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_content_display',
|
||||
[
|
||||
'label' => esc_html__( 'Display As', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'content',
|
||||
'options' => [
|
||||
'content' => esc_html__( 'Post Content', 'wpr-addons' ),
|
||||
'excerpt' => esc_html__( 'Post Excerpt', 'wpr-addons' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// $this->add_control(
|
||||
// 'post_content_dropcap',
|
||||
// [
|
||||
// 'label' => esc_html__( 'Enable Drop Cap', 'wpr-addons' ),
|
||||
// 'type' => Controls_Manager::SWITCHER,
|
||||
// 'return_value' => 'yes',
|
||||
// 'separator' => 'before'
|
||||
// ]
|
||||
// );
|
||||
|
||||
$this->add_responsive_control(
|
||||
'post_content_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => false,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => __( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => __( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => __( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
'justify' => [
|
||||
'title' => __( 'Justified', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-justify',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-content' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
|
||||
|
||||
// Styles ====================
|
||||
// Section: Content ----------
|
||||
$this->start_controls_section(
|
||||
'section_style_content',
|
||||
[
|
||||
'label' => esc_html__( 'Content', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#777777',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-content' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_link_color',
|
||||
[
|
||||
'label' => esc_html__( 'Link Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-content a' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_link_hover_color',
|
||||
[
|
||||
'label' => esc_html__( 'Link Hover Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-content a:hover' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'content_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-post-content',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '14',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_link_transition_duration',
|
||||
[
|
||||
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 0.1,
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
'step' => 0.1,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-content a' => 'transition-duration: {{VALUE}}s',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// $this->add_group_control(
|
||||
// Group_Control_Typography::get_type(),
|
||||
// [
|
||||
// 'name' => 'content_dropcap_typography',
|
||||
// 'label' => esc_html__( 'Drop Cap Typography', 'wpr-addons' ),
|
||||
// 'selector' => '{{WRAPPER}} .wpr-post-content.wpr-enable-dropcap p:first-child:first-letter'
|
||||
// ]
|
||||
// );
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
// Get Settings
|
||||
$settings = $this->get_settings();
|
||||
|
||||
// $dropcap_class = 'yes' === $settings['post_content_dropcap'] ? ' wpr-enable-dropcap' : '';
|
||||
|
||||
echo '<div class="wpr-post-content">';
|
||||
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
||||
$page_templates_module = \Elementor\Plugin::$instance->modules_manager->get_modules( 'page-templates' );
|
||||
|
||||
if ( $page_templates_module ) {
|
||||
$page_templates_module->print_content();
|
||||
}
|
||||
} else {
|
||||
if ( 'content' === $settings['post_content_display'] ) {
|
||||
the_content();
|
||||
} else {
|
||||
the_excerpt();
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostInfo;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-info';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Post_Info', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+1326
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostMedia;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-media';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Post_Media', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+1717
File diff suppressed because it is too large
Load Diff
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostNavigation;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-navigation';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Post_Navigation', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+970
@@ -0,0 +1,970 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostNavigation\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Box_Shadow;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use Elementor\Group_Control_Image_Size;
|
||||
use Elementor\Group_Control_Border;
|
||||
use Elementor\Group_Control_Css_Filter;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Wpr_Post_Navigation extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-navigation';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Post Navigation', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-post-navigation';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
if ( Utilities::show_theme_buider_widget_on('single') ) {
|
||||
return [ 'wpr-theme-builder-widgets' ];
|
||||
} elseif ( Utilities::show_theme_buider_widget_on('product_single') ) {
|
||||
return [ 'wpr-woocommerce-builder-widgets' ];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'navigation', 'arrows', 'pagination' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
public function add_control_display_on_separate_lines() {
|
||||
$this->add_responsive_control(
|
||||
'display_on_separate_lines',
|
||||
[
|
||||
'label' => esc_html__( 'Display on Separate Lines', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'separator' => 'before',
|
||||
'classes' => 'wpr-pro-control',
|
||||
'condition' => [
|
||||
'post_nav_layout' => 'static'
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function add_control_post_nav_layout() {
|
||||
$this->add_control(
|
||||
'post_nav_layout',
|
||||
[
|
||||
'label' => esc_html__( 'Layout', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'static',
|
||||
'options' => [
|
||||
'static' => esc_html__( 'Static Left/Right', 'wpr-addons' ),
|
||||
'pro-fx' => esc_html__( 'Fixed Left/Right (Pro)', 'wpr-addons' ),
|
||||
'pro-fd' => esc_html__( 'Fixed Default (Pro)', 'wpr-addons' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function add_control_post_nav_fixed_default_align() {}
|
||||
|
||||
public function add_control_post_nav_fixed_vr() {}
|
||||
|
||||
public function add_control_post_nav_arrows_loc() {}
|
||||
|
||||
public function add_control_post_nav_title() {}
|
||||
|
||||
public function add_controls_group_post_nav_image() {}
|
||||
|
||||
public function add_controls_group_post_nav_back() {}
|
||||
|
||||
public function add_control_post_nav_query() {}
|
||||
|
||||
public function add_controls_group_post_nav_overlay_style() {}
|
||||
|
||||
public function add_control_post_nav_align_vr() {}
|
||||
|
||||
public function add_section_style_post_nav_back_btn() {}
|
||||
|
||||
public function add_section_style_post_nav_title() {}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_post_navigation',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control_post_nav_layout();
|
||||
|
||||
// Upgrade to Pro Notice
|
||||
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'post-navigation', 'post_nav_layout', ['pro-fx', 'pro-fd'] );
|
||||
|
||||
$this->add_control_post_nav_fixed_default_align();
|
||||
|
||||
$this->add_control_post_nav_fixed_vr();
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrows',
|
||||
[
|
||||
'label' => esc_html__( 'Show Arrows', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
'return_value' => 'yes',
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control_post_nav_arrows_loc();
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_icon',
|
||||
[
|
||||
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
|
||||
'type' => 'wpr-arrow-icons',
|
||||
'default' => 'svg-angle-2-left',
|
||||
'condition' => [
|
||||
'post_nav_arrows' => 'yes',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_labels',
|
||||
[
|
||||
'label' => esc_html__( 'Show Labels', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
'return_value' => 'yes',
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'post_nav_layout!' => 'fixed',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_prev_text',
|
||||
[
|
||||
'label' => esc_html__( 'Previous Text', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'default' => 'Previous Post',
|
||||
'condition' => [
|
||||
'post_nav_labels' => 'yes',
|
||||
'post_nav_layout!' => 'fixed',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_next_text',
|
||||
[
|
||||
'label' => esc_html__( 'Next Text', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'default' => 'Next Post',
|
||||
'condition' => [
|
||||
'post_nav_labels' => 'yes',
|
||||
'post_nav_layout!' => 'fixed',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control_post_nav_title();
|
||||
|
||||
$this->add_controls_group_post_nav_image();
|
||||
|
||||
$this->add_controls_group_post_nav_back();
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_dividers',
|
||||
[
|
||||
'label' => esc_html__( 'Show Dividers', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'return_value' => 'yes',
|
||||
'default' => 'yes',
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'post_nav_layout' => 'static'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control_display_on_separate_lines();
|
||||
|
||||
$this->add_control_post_nav_query();
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
|
||||
|
||||
// Section: Pro Features
|
||||
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'post-navigation', [
|
||||
'Set Navigation Query - Force to navigate posts through specific Taxonomy (category).',
|
||||
'Advanced Layout Options - Fixed Left-Right, Fixed Bottom.',
|
||||
'Multiple Navigation Arrows Locations.',
|
||||
'Show/Hide Post Title.',
|
||||
'Show/Hide Post Thumbnail, Show on hover or set as Navigation Label Background.',
|
||||
'Show/Hide Back Button - Set custom link to any page to go back to.',
|
||||
'Display Navigation on Separate Lines'
|
||||
] );
|
||||
|
||||
// Styles ====================
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_style_general',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
'condition' => [
|
||||
'post_nav_layout!' => 'fixed'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_controls_group_post_nav_overlay_style();
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_background',
|
||||
[
|
||||
'label' => esc_html__( 'Section Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation-wrap' => 'background-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_divider_color',
|
||||
[
|
||||
'label' => esc_html__( 'Divider Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#e8e8e8',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation-wrap' => 'border-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-post-nav-divider' => 'background-color: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'post_nav_layout' => 'static',
|
||||
'post_nav_dividers' => 'yes'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_divider_width',
|
||||
[
|
||||
'label' => esc_html__( 'Divider Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 1,
|
||||
'max' => 5,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-nav-divider' => 'width: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-navigation-wrap' => 'border-width: {{SIZE}}{{UNIT}} 0 {{SIZE}}{{UNIT}} 0;',
|
||||
],
|
||||
'condition' => [
|
||||
'post_nav_layout' => 'static',
|
||||
'post_nav_dividers' => 'yes'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'post_nav_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 0,
|
||||
'right' => 0,
|
||||
'bottom' => 0,
|
||||
'left' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation-wrap.wpr-post-nav-dividers' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-nav-bg-images .wpr-post-navigation' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control_post_nav_align_vr();
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Styles ====================
|
||||
// Section: Arrows -----------
|
||||
$this->start_controls_section(
|
||||
'section_style_post_nav_arrow',
|
||||
[
|
||||
'label' => esc_html__( 'Arrows', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
'condition' => [
|
||||
'post_nav_arrows' => 'yes'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->start_controls_tabs( 'tabs_grid_post_nav_arrow_style' );
|
||||
|
||||
$this->start_controls_tab(
|
||||
'tab_grid_post_nav_arrow_normal',
|
||||
[
|
||||
'label' => __( 'Normal', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-post-navigation svg path' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper svg' => 'fill: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_bg_color',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'background-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper' => 'background-color: {{VALUE}};',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_border_color',
|
||||
[
|
||||
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
|
||||
'default' => '#E8E8E8',
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'border-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper' => 'border-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->start_controls_tab(
|
||||
'tab_grid_post_nav_arrow_hover',
|
||||
[
|
||||
'label' => __( 'Hover', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i:hover' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper:hover svg' => 'fill: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_bg_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i:hover' => 'background-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper:hover' => 'background-color: {{VALUE}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_border_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i:hover' => 'border-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper:hover' => 'border-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->end_controls_tabs();
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_transition_duration',
|
||||
[
|
||||
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 0.5,
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
'step' => 0.1,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'transition: color {{VALUE}}s, background-color {{VALUE}}s, border-color {{VALUE}}s',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper svg' => 'transition: fill {{VALUE}}s',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper' => 'transition: background-color {{VALUE}}s, border-color {{VALUE}}s',
|
||||
'{{WRAPPER}} .wpr-post-nav-fixed.wpr-post-nav-hover img' => 'transition: all {{VALUE}}s ease',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'post_nav_arrow_size',
|
||||
[
|
||||
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 1,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 7,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-navigation svg' => 'width: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-navigation-wrap i' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-navigation-wrap svg' => 'width: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'post_nav_arrow_width',
|
||||
[
|
||||
'label' => esc_html__( 'Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 1,
|
||||
'max' => 200,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 40,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation-wrap i' => 'width: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'width: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper' => 'width: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-nav-fixed.wpr-post-nav-prev img' => 'left: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-nav-fixed.wpr-post-nav-next img' => 'right: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'post_nav_arrow_height',
|
||||
[
|
||||
'label' => esc_html__( 'Height', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 1,
|
||||
'max' => 200,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 50,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation-wrap i' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper' => 'height: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-nav-fixed.wpr-post-navigation img' => 'height: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'post_nav_arrow_distance',
|
||||
[
|
||||
'label' => esc_html__( 'Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-nav-prev i' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-nav-prev .wpr-posts-navigation-svg-wrapper' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-nav-next i' => 'margin-left: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-post-nav-next .wpr-posts-navigation-svg-wrapper' => 'margin-left: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'post_nav_layout!' => 'fixed',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_border_type',
|
||||
[
|
||||
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
|
||||
'double' => esc_html__( 'Double', 'wpr-addons' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
|
||||
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'none',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'border-style: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper' => 'border-style: {{VALUE}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_border_width',
|
||||
[
|
||||
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 1,
|
||||
'right' => 1,
|
||||
'bottom' => 1,
|
||||
'left' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'post_nav_arrow_border_type!' => 'none',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_arrow_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => 0,
|
||||
'right' => 0,
|
||||
'bottom' => 0,
|
||||
'left' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation i' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-posts-navigation-svg-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_image',
|
||||
[
|
||||
'label' => esc_html__( 'Image', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_img_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => 0,
|
||||
'right' => 0,
|
||||
'bottom' => 0,
|
||||
'left' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-navigation img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Styles ====================
|
||||
// Section: Back Button ------
|
||||
$this->add_section_style_post_nav_back_btn();
|
||||
|
||||
// Styles ====================
|
||||
// Section: Labels -----------
|
||||
$this->start_controls_section(
|
||||
'section_style_post_nav_label',
|
||||
[
|
||||
'label' => esc_html__( 'Labels', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
'condition' => [
|
||||
'post_nav_labels' => 'yes',
|
||||
'post_nav_layout!' => 'fixed'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->start_controls_tabs( 'tabs_grid_post_nav_label_style' );
|
||||
|
||||
$this->start_controls_tab(
|
||||
'tab_grid_post_nav_label_normal',
|
||||
[
|
||||
'label' => __( 'Normal', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_label_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-nav-labels span' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'content_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-post-nav-labels span',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '15',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_label_transition_duration',
|
||||
[
|
||||
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 0.5,
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
'step' => 0.1,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-nav-labels span' => 'transition: color {{VALUE}}s',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->start_controls_tab(
|
||||
'tab_grid_post_nav_label_hover',
|
||||
[
|
||||
'label' => __( 'Hover', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_nav_label_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#54595f',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-nav-labels span:hover' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->end_controls_tabs();
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Styles ====================
|
||||
// Section: Title ------------
|
||||
$this->add_section_style_post_nav_title();
|
||||
|
||||
}
|
||||
|
||||
// Arrow Icon
|
||||
public function render_arrow_by_location( $settings, $location, $dir ) {
|
||||
if ( 'fixed' === $settings['post_nav_layout'] || (!defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code()) ) {
|
||||
$settings['post_nav_arrows_loc'] = 'separate';
|
||||
}
|
||||
|
||||
if ( 'yes' === $settings['post_nav_arrows'] && $location === $settings['post_nav_arrows_loc'] ) {
|
||||
if ( false !== strpos( $settings['post_nav_arrow_icon'], 'svg-' ) ) {
|
||||
echo '<div class="wpr-posts-navigation-svg-wrapper">' . Utilities::get_wpr_icon( $settings['post_nav_arrow_icon'], $dir ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
} else {
|
||||
echo Utilities::get_wpr_icon( $settings['post_nav_arrow_icon'], $dir ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
// Get Settings
|
||||
$settings = $this->get_settings();
|
||||
|
||||
if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) {
|
||||
$settings['post_nav_image'] = '';
|
||||
$settings['post_nav_image_bg'] = '';
|
||||
$settings['post_nav_back'] = '';
|
||||
$settings['post_nav_title'] = '';
|
||||
}
|
||||
wp_reset_postdata();
|
||||
|
||||
// Set Query
|
||||
$nav_query = isset($settings['post_nav_query']) ? $settings['post_nav_query'] : 'all';
|
||||
|
||||
// Get Previous and Next Posts
|
||||
if ( 'all' === $nav_query || (!defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code()) ) {
|
||||
$prev_post = get_adjacent_post( false, '', true );
|
||||
$next_post = get_adjacent_post( false, '', false );
|
||||
} else {
|
||||
$prev_post = get_adjacent_post( true, '', true, $nav_query );
|
||||
$next_post = get_adjacent_post( true, '', false, $nav_query );
|
||||
}
|
||||
|
||||
// Layout Class
|
||||
$layout_class = 'wpr-post-navigation wpr-post-nav-'. $settings['post_nav_layout'];
|
||||
|
||||
// Show Image on Hover
|
||||
if ( (isset($settings['post_nav_image_hover']) && 'yes' === $settings['post_nav_image_hover']) ) {
|
||||
$layout_class .= ' wpr-post-nav-hover';
|
||||
}
|
||||
|
||||
$prev_image_url = '';
|
||||
$next_image_url = '';
|
||||
$prev_post_bg = '';
|
||||
$next_post_bg = '';
|
||||
|
||||
// Image URLs
|
||||
if ( ! empty($prev_post) && 'yes' === $settings['post_nav_image'] ) {
|
||||
$prev_img_id = get_post_thumbnail_id( $prev_post->ID );
|
||||
$prev_image_url = Group_Control_Image_Size::get_attachment_image_src( $prev_img_id, 'post_nav_image_width_crop', $settings );
|
||||
}
|
||||
if ( ! empty($next_post) && 'yes' === $settings['post_nav_image'] ) {
|
||||
$next_img_id = get_post_thumbnail_id( $next_post->ID );
|
||||
$next_image_url = Group_Control_Image_Size::get_attachment_image_src( $next_img_id, 'post_nav_image_width_crop', $settings );
|
||||
}
|
||||
|
||||
// Background Images
|
||||
if ( 'yes' === $settings['post_nav_image'] && 'yes' === $settings['post_nav_image_bg'] ) {
|
||||
if ( 'fixed' !== $settings['post_nav_layout'] ) {
|
||||
if ( ! empty($prev_post) ) {
|
||||
$prev_post_bg = ' style="background-image: url('. esc_url($prev_image_url) .')"';
|
||||
}
|
||||
|
||||
if ( ! empty($next_post) ) {
|
||||
$next_post_bg = ' style="background-image: url('. esc_url($next_image_url) .')"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Navigation Wrapper
|
||||
if ( 'fixed' !== $settings['post_nav_layout'] ) {
|
||||
// Layout Class
|
||||
$wrapper_class = 'wpr-post-nav-'. $settings['post_nav_layout'] .'-wrap';
|
||||
|
||||
// Dividers
|
||||
if ( 'static' === $settings['post_nav_layout'] && 'yes' === $settings['post_nav_dividers'] ) {
|
||||
$wrapper_class .= ' wpr-post-nav-dividers';
|
||||
}
|
||||
|
||||
// Background Images
|
||||
if ( 'yes' === $settings['post_nav_image'] && 'yes' === $settings['post_nav_image_bg'] ) {
|
||||
$wrapper_class .= ' wpr-post-nav-bg-images';
|
||||
}
|
||||
|
||||
echo '<div class="wpr-post-navigation-wrap elementor-clearfix '. esc_attr($wrapper_class) .'">';
|
||||
}
|
||||
|
||||
// Previous Post
|
||||
echo '<div class="wpr-post-nav-prev '. esc_attr($layout_class) .'"'. $prev_post_bg .'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
if ( ! empty($prev_post) ) {
|
||||
echo '<a href="'. esc_url( get_permalink($prev_post->ID) ) .'" class="elementor-clearfix">';
|
||||
// Left Arrow
|
||||
$this->render_arrow_by_location( $settings, 'separate', 'left' );
|
||||
|
||||
// Post Thumbnail
|
||||
if ( 'yes' === $settings['post_nav_image'] ) {
|
||||
if ( '' === $settings['post_nav_image_bg'] || 'fixed' === $settings['post_nav_layout'] ) {
|
||||
echo '<img src="'. esc_url( $prev_image_url ) .'" alt="">';
|
||||
}
|
||||
}
|
||||
|
||||
// Label & Title
|
||||
if ( 'fixed' !== $settings['post_nav_layout'] ) {
|
||||
echo '<div class="wpr-post-nav-labels">';
|
||||
// Prev Label
|
||||
if ( 'yes' === $settings['post_nav_labels'] ) {
|
||||
echo '<span>';
|
||||
$this->render_arrow_by_location( $settings, 'label', 'left' );
|
||||
echo esc_html__( $settings['post_nav_prev_text'] );
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
// Post Title
|
||||
if ( 'yes' === $settings['post_nav_title'] ) {
|
||||
echo '<h5>';
|
||||
$this->render_arrow_by_location( $settings, 'title', 'left' );
|
||||
echo esc_html( get_the_title($prev_post->ID) );
|
||||
echo '</h5>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</a>';
|
||||
|
||||
// Image Overlay
|
||||
if ( 'yes' === $settings['post_nav_image_bg'] ) {
|
||||
echo '<div class="wpr-post-nav-overlay"></div>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
// Back to Posts
|
||||
if ( 'fixed' !== $settings['post_nav_layout'] && 'yes' === $settings['post_nav_back'] ) {
|
||||
echo '<div class="wpr-post-nav-back">';
|
||||
echo '<a href="'. esc_url($settings['post_nav_back_link'] ) .'">';
|
||||
echo '<span></span>';
|
||||
echo '<span></span>';
|
||||
echo '<span></span>';
|
||||
echo '<span></span>';
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// Middle Divider
|
||||
if ( 'static' === $settings['post_nav_layout'] && 'yes' === $settings['post_nav_dividers'] && '' === $settings['post_nav_back'] ) {
|
||||
echo '<div class="wpr-post-nav-divider"></div>';
|
||||
}
|
||||
|
||||
// Next Post
|
||||
echo '<div class="wpr-post-nav-next '. esc_attr($layout_class) .'"'. $next_post_bg .'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
if ( ! empty($next_post) ) {
|
||||
echo '<a href="'. esc_url( get_permalink($next_post->ID) ) .'" class="elementor-clearfix">';
|
||||
// Label & Title
|
||||
if ( 'fixed' !== $settings['post_nav_layout'] ) {
|
||||
echo '<div class="wpr-post-nav-labels">';
|
||||
// Next Label
|
||||
if ( 'yes' === $settings['post_nav_labels'] ) {
|
||||
echo '<span>';
|
||||
echo esc_html__( $settings['post_nav_next_text'] );
|
||||
$this->render_arrow_by_location( $settings, 'label', 'right' );
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
// Post Title
|
||||
if ( 'yes' === $settings['post_nav_title'] ) {
|
||||
echo '<h5>';
|
||||
echo esc_html( get_the_title($next_post->ID) );
|
||||
$this->render_arrow_by_location( $settings, 'title', 'right' );
|
||||
echo '</h5>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// Post Thumbnail
|
||||
if ( 'yes' === $settings['post_nav_image'] ) {
|
||||
if ( '' === $settings['post_nav_image_bg'] || 'fixed' === $settings['post_nav_layout'] ) {
|
||||
echo '<img src="'. esc_url( $next_image_url ) .'" alt="">';
|
||||
}
|
||||
}
|
||||
|
||||
// Right Arrow
|
||||
$this->render_arrow_by_location( $settings, 'separate', 'right' );
|
||||
echo '</a>';
|
||||
|
||||
// Image Overlay
|
||||
if ( 'yes' === $settings['post_nav_image_bg'] ) {
|
||||
echo '<div class="wpr-post-nav-overlay"></div>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
// End Navigation Wrapper
|
||||
if ( 'fixed' !== $settings['post_nav_layout'] ) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostTitle;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
use wpraddons\Classes\Utilities;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-title';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Post_Title', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\PostTitle\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Text_Shadow;
|
||||
use Elementor\Group_Control_Text_Stroke;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Wpr_Post_Title extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-post-title';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Post Title', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-site-title';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('single') ? [ 'wpr-theme-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'post', 'title' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_post_title',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'post_title_tag',
|
||||
[
|
||||
'label' => esc_html__( 'Title HTML Tag', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'h1' => 'H1',
|
||||
'h2' => 'H2',
|
||||
'h3' => 'H3',
|
||||
'h4' => 'H4',
|
||||
'h5' => 'H5',
|
||||
'h6' => 'H6',
|
||||
'div' => 'div',
|
||||
'span' => 'span',
|
||||
'P' => 'p'
|
||||
],
|
||||
'default' => 'h1',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'post_title_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'center',
|
||||
'label_block' => false,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => __( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => __( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => __( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-title' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
|
||||
|
||||
// Styles ====================
|
||||
// Section: Title ------------
|
||||
$this->start_controls_section(
|
||||
'section_style_title',
|
||||
[
|
||||
'label' => esc_html__( 'Title', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#333333',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-title' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-post-title',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '30',
|
||||
'unit' => 'px',
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Text_Stroke::get_type(),
|
||||
[
|
||||
'name' => 'text_stroke',
|
||||
'selector' => '{{WRAPPER}} .wpr-post-title',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Text_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'title_shadow',
|
||||
'selector' => '{{WRAPPER}} .wpr-post-title',
|
||||
'separator' => 'after',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'blend_mode',
|
||||
[
|
||||
'label' => esc_html__( 'Blend Mode', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'' => esc_html__( 'Normal', 'wpr-addons' ),
|
||||
'multiply' => 'Multiply',
|
||||
'screen' => 'Screen',
|
||||
'overlay' => 'Overlay',
|
||||
'darken' => 'Darken',
|
||||
'lighten' => 'Lighten',
|
||||
'color-dodge' => 'Color Dodge',
|
||||
'saturation' => 'Saturation',
|
||||
'color' => 'Color',
|
||||
'difference' => 'Difference',
|
||||
'exclusion' => 'Exclusion',
|
||||
'hue' => 'Hue',
|
||||
'luminosity' => 'Luminosity',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-post-title' => 'mix-blend-mode: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'none',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
// Get Settings
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
$tags_whitelist = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p'];
|
||||
$post_title_tag = Utilities::validate_html_tags_wl( $settings['post_title_tag'], 'h1', $tags_whitelist );
|
||||
|
||||
echo '<'. esc_attr($post_title_tag) .' class="wpr-post-title">';
|
||||
echo esc_html(get_the_title());
|
||||
echo '</'. esc_attr($post_title_tag) .'>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\PageCart;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-page-cart';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Page_Cart', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+2568
File diff suppressed because it is too large
Load Diff
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\PageCheckout;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-page-checkout';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Page_Checkout', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+1751
File diff suppressed because it is too large
Load Diff
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductAddToCart;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-add-to-cart';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_AddToCart', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+2134
File diff suppressed because it is too large
Load Diff
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductAdditionalInformation;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-additional-information';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_AdditionalInformation', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+386
@@ -0,0 +1,386 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductAdditionalInformation\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Box_Shadow;
|
||||
use Elementor\Group_Control_Text_Shadow;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use Elementor\Group_Control_Image_Size;
|
||||
use Elementor\Group_Control_Background;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_AdditionalInformation extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-additional-information';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Additional Information', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-product-info';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-additional-information', 'product', 'additional information', 'information' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
public function get_script_depends() {
|
||||
return [ 'wc-single-product' ];
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
$this->start_controls_section(
|
||||
'additional_info_syles',
|
||||
[
|
||||
'label' => esc_html__('Additional Information', 'wpr-addons'),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_label',
|
||||
[
|
||||
'label' => esc_html__('Attribute Name', 'wpr-addons'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_label_color',
|
||||
[
|
||||
'label' => esc_html__('Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#888888',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table th' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_label_odd_bg_color',
|
||||
[
|
||||
'label' => esc_html__('Background Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#f8f8f8',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table th' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_label_even_bg_color',
|
||||
[
|
||||
'label' => esc_html__('Even Background Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table tr:nth-child(even) th' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'additional_info_th_typography',
|
||||
'label' => esc_html__('Typography', 'wpr-addons'),
|
||||
'selector' => '{{WRAPPER}} .wpr-product-additional-information tr :is(th)',
|
||||
'exclude' => ['font_family', 'text_transform', 'text_decoration'],
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'label' => esc_html__('Font Size (px)', 'wpr-addons'),
|
||||
'size_units' => ['px'],
|
||||
'default' => [
|
||||
'size' => '16',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
'font_weight' => [
|
||||
'default' => '400',
|
||||
],
|
||||
'text_transform' => [
|
||||
'default' => 'none',
|
||||
],
|
||||
'line_height' => [
|
||||
'label' => esc_html__('Line Height (px)', 'wpr-addons'),
|
||||
'default' => [
|
||||
'size' => '19',
|
||||
'unit' => 'px',
|
||||
],
|
||||
'size_units' => ['px'],
|
||||
'tablet_default' => [
|
||||
'unit' => 'px',
|
||||
],
|
||||
'mobile_default' => [
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
'letter_spacing' => [
|
||||
'label' => esc_html__('Letter Spacing (px)', 'wpr-addons'),
|
||||
'size_units' => ['px'],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_th_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table th' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
'default' => 'left',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'additional_info_label_width',
|
||||
[
|
||||
'label' => esc_html__('Width', 'wpr-addons'),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px', '%'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
'step' => 5,
|
||||
],
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => '%',
|
||||
'size' => 25,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table th' => 'width: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_value_heading',
|
||||
[
|
||||
'label' => esc_html__('Attribute Value', 'wpr-addons'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_information_value_color',
|
||||
[
|
||||
'label' => esc_html__('Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#101010',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table td p' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_information_value_odd_bg_color',
|
||||
[
|
||||
'label' => esc_html__('Background Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#fdfdfd',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table td' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_information_value_even_bg_color',
|
||||
[
|
||||
'label' => esc_html__('Even Background Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table tr:nth-child(even) td' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'additional_info_td_typography',
|
||||
'label' => esc_html__('Typography', 'wpr-addons'),
|
||||
'selector' => '{{WRAPPER}} .wpr-product-additional-information tr :is(td, p)',
|
||||
'exclude' => ['font_family', 'text_transform', 'text_decoration'],
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'label' => esc_html__('Font Size (px)', 'wpr-addons'),
|
||||
'size_units' => ['px'],
|
||||
'default' => [
|
||||
'size' => '16',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
'font_weight' => [
|
||||
'default' => '400',
|
||||
],
|
||||
'text_transform' => [
|
||||
'default' => 'none',
|
||||
],
|
||||
'line_height' => [
|
||||
'label' => esc_html__('Line Height (px)', 'wpr-addons'),
|
||||
'default' => [
|
||||
'size' => '19',
|
||||
'unit' => 'px',
|
||||
],
|
||||
'size_units' => ['px'],
|
||||
'tablet_default' => [
|
||||
'unit' => 'px',
|
||||
],
|
||||
'mobile_default' => [
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
'letter_spacing' => [
|
||||
'label' => esc_html__('Letter Spacing (px)', 'wpr-addons'),
|
||||
'size_units' => ['px'],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'additional_info_padding',
|
||||
[
|
||||
'label' => esc_html__('Padding', 'wpr-addons'),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'default' => [
|
||||
'top' => '15',
|
||||
'right' => '35',
|
||||
'bottom' => '15',
|
||||
'left' => '35',
|
||||
'unit' => 'px',
|
||||
'isLinked' => false,
|
||||
],
|
||||
'separator' => 'before',
|
||||
'size_units' => ['px'],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-product-additional-information table th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_divider_color',
|
||||
[
|
||||
'label' => esc_html__('Divider (Border) Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#f2f2f2',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table td' => 'border-color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-additional-information table th' => 'border-color: {{VALUE}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_border_width',
|
||||
[
|
||||
'label' => esc_html__( 'Divider (Border) Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-additional-information table tr:not(:last-child) td' => 'border-bottom-width: {{SIZE}}px; border-bottom-style: solid;',
|
||||
'{{WRAPPER}} .wpr-product-additional-information table tr:not(:last-child) th' => 'border-bottom-width: {{SIZE}}px; border-bottom-style: solid;',
|
||||
'{{WRAPPER}}.wpr-add-info-borders-yes .wpr-product-additional-information table td' => 'border-width: {{SIZE}}px; border-style: solid;',
|
||||
'{{WRAPPER}}.wpr-add-info-borders-yes .wpr-product-additional-information table th' => 'border-width: {{SIZE}}px; border-style: solid;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'additional_info_show_borders',
|
||||
[
|
||||
'label' => esc_html__( 'Show Table Borders', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'return_value' => 'yes',
|
||||
'prefix_class' => 'wpr-add-info-borders-'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, Controls_Manager::TAB_STYLE );
|
||||
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
global $product;
|
||||
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( empty( $product ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
setup_postdata( $product->get_id() );
|
||||
|
||||
$heading = apply_filters( 'woocommerce_product_additional_information_heading', esc_html__( 'Additional information', 'wpr-addons' ) );
|
||||
|
||||
echo '<div class="wpr-product-additional-information">';
|
||||
do_action('woocommerce_product_additional_information', $product);
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductDescription;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-description';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Description', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductDescription\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Description extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-description';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Description', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-product-description';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-description', 'product', 'description' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_product_description',
|
||||
[
|
||||
'label' => esc_html__( 'Styles', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'description_html',
|
||||
[
|
||||
'label' => esc_html__( 'Render as HTML', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'no',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'description_color',
|
||||
[
|
||||
'label' => esc_html__('Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#787878',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-description p' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-description li' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-description a' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-description pre' => 'color: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
array(
|
||||
'name' => 'description_typography',
|
||||
'label' => esc_html__('Typography', 'wpr-addons'),
|
||||
'selector' => '{{WRAPPER}} .wpr-product-description p, {{WRAPPER}} .wpr-product-description li, {{WRAPPER}} .wpr-product-description a, {{WRAPPER}} pre',
|
||||
'exclude' => ['text_decoration'],
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '14',
|
||||
'unit' => 'px'
|
||||
],
|
||||
'label' => 'Font size (px)',
|
||||
'size_units' => ['px'],
|
||||
],
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'description_align',
|
||||
[
|
||||
'label' => esc_html__('Alignment', 'wpr-addons'),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'left',
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__('Left', ''),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__('Center', ''),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__('Right', ''),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
]
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-description p' => 'text-align: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-product-description pre' => 'text-align: {{VALUE}}'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, Controls_Manager::TAB_STYLE );
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
global $product;
|
||||
|
||||
if ( empty( $product ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post = get_post( $product->get_id() );
|
||||
setup_postdata( $product->get_id() );
|
||||
|
||||
if ($post) {
|
||||
// Get the product description
|
||||
if ( 'yes' === $settings['description_html'] ) {
|
||||
$description = '<pre>' . $product->get_description() . '</pre>';
|
||||
} else {
|
||||
$description = $product->get_description();
|
||||
}
|
||||
|
||||
// Print the description
|
||||
echo '<div class="wpr-product-description">';
|
||||
echo '<p>'. $description .'</p>';
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '<div class="wpr-product-description">';
|
||||
echo '<p>'. esc_html__('Product not found', 'wpr-addons') .'</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductExcerpt;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-excerpt';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Excerpt', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductExcerpt\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Excerpt extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-excerpt';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Excerpt', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-post-excerpt';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-excerpt', 'product', 'excerpt' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_product_excerpt',
|
||||
[
|
||||
'label' => esc_html__( 'Styles', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'excerpt_color',
|
||||
[
|
||||
'label' => esc_html__('Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#787878',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-excerpt p' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-excerpt li' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-excerpt a' => 'color: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
array(
|
||||
'name' => 'excerpt_typography',
|
||||
'label' => esc_html__('Typography', 'wpr-addons'),
|
||||
'selector' => '{{WRAPPER}} .wpr-product-excerpt p, {{WRAPPER}} .wpr-product-excerpt li, {{WRAPPER}} .wpr-product-excerpt a',
|
||||
'exclude' => ['text_decoration'],
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '14',
|
||||
'unit' => 'px'
|
||||
],
|
||||
'label' => 'Font size (px)',
|
||||
'size_units' => ['px'],
|
||||
],
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'excerpt_align',
|
||||
[
|
||||
'label' => esc_html__('Alignment', 'wpr-addons'),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'left',
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__('Left', ''),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__('Center', ''),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__('Right', ''),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
]
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-excerpt p' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, Controls_Manager::TAB_STYLE );
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
global $product;
|
||||
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( empty( $product ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post = get_post( $product->get_id() );
|
||||
setup_postdata( $product->get_id() );
|
||||
|
||||
$product_excerpt = apply_filters('woocommerce_short_description', $post->post_excerpt);
|
||||
|
||||
echo '<div class="wpr-product-excerpt">';
|
||||
echo $product_excerpt;
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductMedia;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-media';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Media', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+1638
File diff suppressed because it is too large
Load Diff
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductMeta;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-meta';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Meta', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductMeta\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Meta extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-meta';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Meta', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-post-info';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-meta', 'product', 'meta' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_product_meta_styles',
|
||||
[
|
||||
'label' => esc_html__( 'Styles', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_meta_layout',
|
||||
[
|
||||
'label' => esc_html__( 'Select Layout', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'vertical',
|
||||
'options' => [
|
||||
'column' => [
|
||||
'title' => esc_html__( 'Vertical', 'wpr-addons' ),
|
||||
'icon' => 'eicon-editor-list-ul',
|
||||
],
|
||||
'row' => [
|
||||
'title' => esc_html__( 'Horizontal', 'wpr-addons' ),
|
||||
'icon' => 'eicon-ellipsis-h',
|
||||
],
|
||||
],
|
||||
'prefix_class' => 'wpr-product-meta-',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-meta .product_meta' => 'display: flex; flex-direction: {{VALUE}};'
|
||||
],
|
||||
'default' => 'column',
|
||||
'label_block' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'meta_align',
|
||||
[
|
||||
'label' => esc_html__('Alignment', 'wpr-addons'),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'left',
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__('Left', 'wpr-addons'),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__('Center', 'wpr-addons'),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__('Right', 'wpr-addons'),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'prefix_class' => 'wpr-product-meta-',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-meta .product_meta' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'product_meta_gutter',
|
||||
[
|
||||
'label' => esc_html__( 'List Gutter', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 7,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.wpr-product-meta-column .product_meta span:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}}.wpr-product-meta-row .product_meta span:not(last-child)' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'meta_label_title',
|
||||
[
|
||||
'label' => esc_html__('Title', 'wpr-addons'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'meta_title_color',
|
||||
[
|
||||
'label' => esc_html__('Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#787878',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-meta .product_meta :is(.sku_wrapper, .posted_in, .tagged_as)' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_meta_value',
|
||||
[
|
||||
'label' => esc_html__('Value', 'wpr-addons'),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'meta_value_color',
|
||||
[
|
||||
'label' => esc_html__('Value Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#787878',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-meta .product_meta :is(.sku, .posted_in a, .tagged_as a)' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'meta_value_link_hover_color',
|
||||
[
|
||||
'label' => esc_html__('Link Hover Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'separator' => 'after',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-meta .product_meta :is(.posted_in a, .tagged_as a):hover' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'product_meta_typography',
|
||||
'label' => esc_html__('Typography', 'wpr-addons'),
|
||||
'selector' => '{{WRAPPER}} .wpr-product-meta .product_meta :is(a, span, .sku_wrapper, .posted_in, .tagged_as)',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'label' => esc_html__('Font Size (px)', 'wpr-addons'),
|
||||
'size_units' => ['px'],
|
||||
'default' => [
|
||||
'size' => '13',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
'font_weight' => [
|
||||
'default' => '500',
|
||||
],
|
||||
'text_transform' => [
|
||||
'default' => 'none',
|
||||
],
|
||||
'line_height' => [
|
||||
'label' => esc_html__('Line Height (px)', 'wpr-addons'),
|
||||
'default' => [
|
||||
'size' => '17',
|
||||
'unit' => 'px',
|
||||
],
|
||||
'size_units' => ['px'],
|
||||
'tablet_default' => [
|
||||
'unit' => 'px',
|
||||
],
|
||||
'mobile_default' => [
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'meta_sku_hide',
|
||||
[
|
||||
'label' => esc_html__('SKU', 'wpr-addons'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => esc_html__('Show', 'wpr-addons'),
|
||||
'label_off' => esc_html__('Hide', 'wpr-addons'),
|
||||
'default' => "yes",
|
||||
'return_value' => "yes",
|
||||
'prefix_class' => 'wpr-product-meta-sku-',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.wpr-product-meta-column .wpr-product-meta .sku_wrapper' => 'display: inline-block;',
|
||||
'{{WRAPPER}}.wpr-product-meta-row .wpr-product-meta .sku_wrapper' => 'display: inline-block;',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'meta_category_hide',
|
||||
[
|
||||
'label' => esc_html__('Category', 'wpr-addons'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => esc_html__('Show', 'wpr-addons'),
|
||||
'label_off' => esc_html__('Hide', 'wpr-addons'),
|
||||
'default' => "yes",
|
||||
'return_value' => "yes",
|
||||
'prefix_class' => 'wpr-product-meta-cat-',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.wpr-product-meta-column .wpr-product-meta .posted_in' => 'display: inline-block;',
|
||||
'{{WRAPPER}}.wpr-product-meta-row .wpr-product-meta .posted_in' => 'display: inline-block;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'meta_tag_hide',
|
||||
[
|
||||
'label' => esc_html__('Tag', 'wpr-addons'),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => esc_html__('Show', 'wpr-addons'),
|
||||
'label_off' => esc_html__('Hide', 'wpr-addons'),
|
||||
'default' => "yes",
|
||||
'return_value' => "yes",
|
||||
'prefix_class' => 'wpr-product-meta-tag-',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.wpr-product-meta-column .wpr-product-meta .tagged_as' => 'display: inline-block;',
|
||||
'{{WRAPPER}}.wpr-product-meta-row .wpr-product-meta .tagged_as' => 'display: inline-block;',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, Controls_Manager::TAB_STYLE );
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
global $product;
|
||||
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( empty( $product ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post = get_post( $product->get_id() );
|
||||
setup_postdata( $product->get_id() );
|
||||
|
||||
echo '<div class="wpr-product-meta">';
|
||||
woocommerce_template_single_meta();
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductMiniCart;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-mini-cart';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Mini_Cart', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+661
@@ -0,0 +1,661 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductMiniCart\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Box_Shadow;
|
||||
use Elementor\Group_Control_Text_Shadow;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use Elementor\Group_Control_Image_Size;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Mini_Cart extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-mini-cart';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Mini Cart', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-product-images';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [] : ['wpr-woocommerce-builder-widgets'];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-ini-cart', 'product', 'mini', 'cart' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
public function get_script_depends() {
|
||||
return ['wpr-perfect-scroll-js'];
|
||||
}
|
||||
|
||||
public function add_control_mini_cart_style() {
|
||||
$this->add_control(
|
||||
'mini_cart_style',
|
||||
[
|
||||
'label' => esc_html__( 'Cart Content', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'separator' => 'before',
|
||||
'render_type' => 'template',
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'pro-dd' => esc_html__( 'Dropdown (Pro)', 'wpr-addons' ),
|
||||
'pro-sb' => esc_html__( 'Sidebar (Pro)', 'wpr-addons' )
|
||||
],
|
||||
'default' => 'none'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function get_custom_help_url() {
|
||||
if ( empty(get_option('wpr_wl_plugin_links')) )
|
||||
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-progress-bar-help-btn';
|
||||
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
|
||||
}
|
||||
|
||||
public function is_reload_preview_required() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function add_controls_group_mini_cart_style() {}
|
||||
|
||||
public function add_section_style_mini_cart() {}
|
||||
|
||||
public function add_section_style_remove_icon() {}
|
||||
|
||||
public function add_section_style_buttons() {}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_mini_cart_general',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'icon',
|
||||
[
|
||||
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'cart-light' => esc_html__( 'Cart Light', 'wpr-addons' ),
|
||||
'cart-medium' => esc_html__( 'Cart Medium', 'wpr-addons' ),
|
||||
'cart-solid' => esc_html__( 'Cart Solid', 'wpr-addons' ),
|
||||
'basket-light' => esc_html__( 'Basket Light', 'wpr-addons' ),
|
||||
'basket-medium' => esc_html__( 'Basket Medium', 'wpr-addons' ),
|
||||
'basket-solid' => esc_html__( 'Basket Solid', 'wpr-addons' ),
|
||||
'bag-light' => esc_html__( 'Bag Light', 'wpr-addons' ),
|
||||
'bag-medium' => esc_html__( 'Bag Medium', 'wpr-addons' ),
|
||||
'bag-solid' => esc_html__( 'Bag Solid', 'wpr-addons' )
|
||||
],
|
||||
'render_type' => 'template',
|
||||
'default' => 'cart-medium',
|
||||
'prefix_class' => 'wpr-toggle-icon-',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_text',
|
||||
[
|
||||
'label' => esc_html__( 'Toggle Prefix', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'price' => esc_html__( 'Total Price', 'wpr-addons' ),
|
||||
'title' => esc_html__( 'Extra Text', 'wpr-addons' )
|
||||
],
|
||||
'default' => 'price',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_title',
|
||||
[
|
||||
'label' => esc_html__( 'Text', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'placeholder' => esc_html__( 'Cart', 'wpr-addons' ),
|
||||
'default' => esc_html__( 'Cart', 'wpr-addons' ),
|
||||
'condition' => [
|
||||
'toggle_text' => 'title'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'mini_cart_button_alignment',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'right',
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Start', 'wpr-addons' ),
|
||||
'icon' => 'eicon-h-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-h-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'End', 'wpr-addons' ),
|
||||
'icon' => 'eicon-h-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-wrap' => 'text-align: {{VALUE}};',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control_mini_cart_style();
|
||||
|
||||
$this->add_controls_group_mini_cart_style();
|
||||
|
||||
// Upgrade to Pro Notice
|
||||
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'product-mini-cart', 'mini_cart_style', ['pro-dd', 'pro-sb'] );
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
|
||||
|
||||
// Section: Pro Features
|
||||
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'product-mini-cart', [
|
||||
'Show Mini Cart Content (Products added to cart) on Mini Cart icon click',
|
||||
'Display Mini Cart Content as Dropdown or Off-Canvas Layout'
|
||||
] );
|
||||
|
||||
// Tab: Styles ==============
|
||||
// Section: Toggle Button ----------
|
||||
$this->start_controls_section(
|
||||
'section_mini_cart_button',
|
||||
[
|
||||
'label' => esc_html__( 'Cart Button', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_btn_cart_icon',
|
||||
[
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'label' => esc_html__( 'Icon', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_btn_icon_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#222222',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-btn-icon' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-mini-cart-btn-icon svg' => 'fill: {{VALUE}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_btn_icon_color_hover',
|
||||
[
|
||||
'label' => esc_html__( 'Color (Hover)', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-btn-icon:hover' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .wpr-mini-cart-btn-icon:hover svg' => 'fill: {{VALUE}}'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'toggle_btn_icon_size',
|
||||
[
|
||||
'label' => esc_html__( 'Size', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 5,
|
||||
'max' => 50,
|
||||
]
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 18,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-btn-icon' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-mini-cart-btn-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_btn_cart_title',
|
||||
[
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'label' => esc_html__( 'Extra Text', 'wpr-addons' ),
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'toggle_text!' => 'none'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'mini_cart_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#777777',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-toggle-btn' => 'color: {{VALUE}}',
|
||||
],
|
||||
'condition' => [
|
||||
'toggle_text!' => 'none'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'label' => __( 'Typography', 'wpr-addons' ),
|
||||
'selector' => '{{WRAPPER}} .wpr-mini-cart-toggle-btn, {{WRAPPER}} .wpr-mini-cart-icon-count',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '13',
|
||||
'unit' => 'px',
|
||||
]
|
||||
],
|
||||
'font_style' => [
|
||||
'default' => 'normal'
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'toggle_text_distance',
|
||||
[
|
||||
'label' => esc_html__( 'Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 25,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'size' => 5,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-btn-text' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-mini-cart-btn-price' => 'margin-right: {{SIZE}}{{UNIT}};'
|
||||
],
|
||||
'condition' => [
|
||||
'toggle_text!' => 'none'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'mini_cart_btn_bg_color',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FFFFFF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-toggle-btn' => 'background-color: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'mini_cart_btn_border_color',
|
||||
[
|
||||
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#E8E8E8',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-toggle-btn' => 'border-color: {{VALUE}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'mini_cart_btn_box_shadow',
|
||||
'selector' => '{{WRAPPER}} .wpr-mini-cart-toggle-btn',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'mini_cart_btn_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => 10,
|
||||
'right' => 10,
|
||||
'bottom' => 10,
|
||||
'left' => 10,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-toggle-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'mini_cart_btn_border_type',
|
||||
[
|
||||
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
|
||||
'double' => esc_html__( 'Double', 'wpr-addons' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
|
||||
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'none',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-toggle-btn' => 'border-style: {{VALUE}};',
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'mini_cart_btn_border_width',
|
||||
[
|
||||
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 1,
|
||||
'right' => 1,
|
||||
'bottom' => 1,
|
||||
'left' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-toggle-btn' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'mini_cart_btn_border_type!' => 'none',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'mini_cart_btn_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => 0,
|
||||
'right' => 0,
|
||||
'bottom' => 0,
|
||||
'left' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-toggle-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_btn_item_count',
|
||||
[
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'label' => esc_html__( 'Item Count', 'wpr-addons' ),
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_btn_item_count_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FFF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-icon-count' => 'color: {{VALUE}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'toggle_btn_item_count_bg_color',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-icon-count' => 'background-color: {{VALUE}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'toggle_btn_item_count_font_size',
|
||||
[
|
||||
'label' => esc_html__( 'Size', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 5,
|
||||
'max' => 25,
|
||||
]
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 12,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-icon-count' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'toggle_btn_item_count_box_size',
|
||||
[
|
||||
'label' => esc_html__( 'Box Size', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 5,
|
||||
'max' => 50,
|
||||
]
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 18,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-icon-count' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'toggle_btn_item_count_position',
|
||||
[
|
||||
'label' => esc_html__( 'Position', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ '%' ],
|
||||
'range' => [
|
||||
'%' => [
|
||||
'min' => 20,
|
||||
'max' => 100,
|
||||
]
|
||||
],
|
||||
'default' => [
|
||||
'unit' => '%',
|
||||
'size' => 65,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-mini-cart-icon-count' => 'bottom: {{SIZE}}{{UNIT}}; left: {{SIZE}}{{UNIT}};',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Tab: Styles ==============
|
||||
// Section: Mini Cart ---------------
|
||||
$this->add_section_style_mini_cart();
|
||||
|
||||
// Tab: Styles ==============
|
||||
// Section: Remove Icon ----------
|
||||
$this->add_section_style_remove_icon();
|
||||
|
||||
// Tab: Style ==============
|
||||
// Section: Buttons --------
|
||||
$this->add_section_style_buttons();
|
||||
|
||||
}
|
||||
|
||||
public function render_svg_inline_icons( $settings ) {
|
||||
// Define your SVG icons
|
||||
$svg_icons = [
|
||||
'cart-light' => '<svg class="e-font-icon-svg e-eicon-cart-light" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M708 854C708 889 736 917 771 917 805 917 833 889 833 854 833 820 805 792 771 792 736 792 708 820 708 854ZM188 167L938 167C950 167 960 178 958 190L926 450C919 502 875 542 822 542L263 542 271 583C281 632 324 667 373 667L854 667C866 667 875 676 875 687 875 699 866 708 854 708L373 708C304 708 244 659 230 591L129 83 21 83C9 83 0 74 0 62 0 51 9 42 21 42L146 42C156 42 164 49 166 58L188 167ZM196 208L255 500 822 500C854 500 880 476 884 445L914 208 196 208ZM667 854C667 797 713 750 771 750 828 750 875 797 875 854 875 912 828 958 771 958 713 958 667 912 667 854ZM250 854C250 797 297 750 354 750 412 750 458 797 458 854 458 912 412 958 354 958 297 958 250 912 250 854ZM292 854C292 889 320 917 354 917 389 917 417 889 417 854 417 820 389 792 354 792 320 792 292 820 292 854Z"></path></svg>',
|
||||
'cart-medium' => '<svg class="e-font-icon-svg e-eicon-cart-medium" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M740 854C740 883 763 906 792 906S844 883 844 854 820 802 792 802 740 825 740 854ZM217 156H958C977 156 992 173 989 191L957 452C950 509 901 552 843 552H297L303 581C311 625 350 656 395 656H875C892 656 906 670 906 687S892 719 875 719H394C320 719 255 666 241 593L141 94H42C25 94 10 80 10 62S25 31 42 31H167C182 31 195 42 198 56L217 156ZM230 219L284 490H843C869 490 891 470 895 444L923 219H230ZM677 854C677 791 728 740 792 740S906 791 906 854 855 969 792 969 677 918 677 854ZM260 854C260 791 312 740 375 740S490 791 490 854 438 969 375 969 260 918 260 854ZM323 854C323 883 346 906 375 906S427 883 427 854 404 802 375 802 323 825 323 854Z"></path></svg>',
|
||||
'cart-solid' => '<svg class="e-font-icon-svg e-eicon-cart-solid" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M188 167H938C943 167 949 169 953 174 957 178 959 184 958 190L926 450C919 502 875 542 823 542H263L271 583C281 631 324 667 373 667H854C866 667 875 676 875 687S866 708 854 708H373C304 708 244 659 230 591L129 83H21C9 83 0 74 0 62S9 42 21 42H146C156 42 164 49 166 58L188 167ZM771 750C828 750 875 797 875 854S828 958 771 958 667 912 667 854 713 750 771 750ZM354 750C412 750 458 797 458 854S412 958 354 958 250 912 250 854 297 750 354 750Z"></path></svg>',
|
||||
'basket-light' => '<svg class="e-font-icon-svg e-eicon-basket-light" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M125 375C125 375 125 375 125 375H256L324 172C332 145 358 125 387 125H655C685 125 711 145 718 173L786 375H916C917 375 917 375 917 375H979C991 375 1000 384 1000 396S991 417 979 417H935L873 798C860 844 820 875 773 875H270C223 875 182 844 169 796L107 417H63C51 417 42 407 42 396S51 375 63 375H125ZM150 417L210 787C217 814 242 833 270 833H773C801 833 825 815 833 790L893 417H150ZM742 375L679 185C676 174 666 167 655 167H387C376 167 367 174 364 184L300 375H742ZM500 521C500 509 509 500 521 500S542 509 542 521V729C542 741 533 750 521 750S500 741 500 729V521ZM687 732C685 743 675 751 663 750 652 748 644 737 646 726L675 520C677 508 688 500 699 502 710 504 718 514 717 526L687 732ZM395 726C397 737 389 748 378 750 367 752 356 744 354 732L325 526C323 515 331 504 343 502 354 500 365 508 366 520L395 726Z"></path></svg>',
|
||||
'basket-medium' => '<svg class="e-font-icon-svg e-eicon-basket-medium" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M104 365C104 365 105 365 105 365H208L279 168C288 137 320 115 355 115H646C681 115 713 137 723 170L793 365H896C896 365 897 365 897 365H958C975 365 990 379 990 396S975 427 958 427H923L862 801C848 851 803 885 752 885H249C198 885 152 851 138 798L78 427H42C25 427 10 413 10 396S25 365 42 365H104ZM141 427L199 785C205 807 225 823 249 823H752C775 823 796 807 801 788L860 427H141ZM726 365L663 189C660 182 654 177 645 177H355C346 177 340 182 338 187L274 365H726ZM469 521C469 504 483 490 500 490S531 504 531 521V729C531 746 517 760 500 760S469 746 469 729V521ZM677 734C674 751 658 762 641 760 624 758 613 742 615 725L644 519C647 502 663 490 680 492S708 510 706 527L677 734ZM385 725C388 742 375 757 358 760 341 762 325 750 323 733L293 527C291 510 303 494 320 492 337 489 353 501 355 518L385 725Z"></path></svg>
|
||||
',
|
||||
'basket-solid' => '<svg class="e-font-icon-svg e-eicon-basket-solid" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M128 417H63C51 417 42 407 42 396S51 375 63 375H256L324 172C332 145 358 125 387 125H655C685 125 711 145 718 173L786 375H979C991 375 1000 384 1000 396S991 417 979 417H913L853 793C843 829 810 854 772 854H270C233 854 200 829 190 793L128 417ZM742 375L679 185C676 174 666 167 655 167H387C376 167 367 174 364 184L300 375H742ZM500 521V729C500 741 509 750 521 750S542 741 542 729V521C542 509 533 500 521 500S500 509 500 521ZM687 732L717 526C718 515 710 504 699 502 688 500 677 508 675 520L646 726C644 737 652 748 663 750 675 751 686 743 687 732ZM395 726L366 520C364 509 354 501 342 502 331 504 323 515 325 526L354 732C356 744 366 752 378 750 389 748 397 737 395 726Z"></path></svg>',
|
||||
'bag-light' => '<svg class="e-font-icon-svg e-eicon-bag-light" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M333 292L333 208C339 100 397 43 501 43 605 43 662 100 667 209V292H750C796 292 833 329 833 375V875C833 921 796 958 750 958H250C204 958 167 921 167 875V375C167 329 204 292 250 292H333ZM375 292H625L625 210C622 125 582 85 501 85 420 85 380 125 375 209L375 292ZM333 333H250C227 333 208 352 208 375V875C208 898 227 917 250 917H750C773 917 792 898 792 875V375C792 352 773 333 750 333H667V454C667 466 658 475 646 475S625 466 625 454L625 333H375L375 454C375 466 366 475 354 475 343 475 333 466 333 454L333 333Z"></path></svg>
|
||||
',
|
||||
'bag-medium' => '<svg class="e-font-icon-svg e-eicon-bag-medium" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M323 292L323 207C329 95 391 33 501 33 610 33 673 95 677 209V292H750C796 292 833 329 833 375V875C833 921 796 958 750 958H250C204 958 167 921 167 875V375C167 329 204 292 250 292H323ZM385 292H615L615 210C611 130 577 95 501 95 425 95 390 130 385 209L385 292ZM323 354H250C238 354 229 363 229 375V875C229 887 238 896 250 896H750C762 896 771 887 771 875V375C771 363 762 354 750 354H677V454C677 471 663 485 646 485S615 471 615 454L615 354H385L385 454C385 471 371 485 354 485 337 485 323 471 323 454L323 354Z"></path></svg>',
|
||||
'bag-solid' => '<svg class="e-font-icon-svg e-eicon-bag-solid" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"><path d="M333 292L333 208C339 100 397 43 501 43 605 43 662 100 667 209V292H750C796 292 833 329 833 375V875C833 921 796 958 750 958H250C204 958 167 921 167 875V375C167 329 204 292 250 292H333ZM375 292H625L625 210C622 125 582 85 501 85 420 85 380 125 375 209L375 292Z"></path></svg>',
|
||||
];
|
||||
|
||||
// Get the selected icon from the widget settings
|
||||
$selected_icon = $settings['icon'];
|
||||
|
||||
// Check if the selected icon exists in the SVG icons array
|
||||
if ( array_key_exists( $selected_icon, $svg_icons ) ) {
|
||||
// Render the SVG icon
|
||||
echo $svg_icons[$selected_icon];
|
||||
}
|
||||
}
|
||||
|
||||
public function render_mini_cart_toggle($settings) {
|
||||
|
||||
if ( null === WC()->cart ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$product_count = WC()->cart->get_cart_contents_count();
|
||||
$sub_total = WC()->cart->get_cart_subtotal();
|
||||
$counter_attr = 'data-counter="' . $product_count . '"';
|
||||
if ( \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_font_icon_svg' ) ) {
|
||||
$icon_class = $settings['icon'] . ' wpr-inline-svg';
|
||||
} else {
|
||||
$icon_class = 'eicon';
|
||||
}
|
||||
|
||||
if ( !is_plugin_active('wpr-addons-pro/wpr-addons-pro.php') || 'none' == $settings['mini_cart_style'] ) {
|
||||
// global $woocommerce;
|
||||
$cart_url = wc_get_cart_url();
|
||||
} else {
|
||||
$cart_url = '#';
|
||||
}
|
||||
?>
|
||||
|
||||
<span class="wpr-mini-cart-toggle-wrap">
|
||||
<a href=<?php echo $cart_url ?> class="wpr-mini-cart-toggle-btn" aria-expanded="false">
|
||||
<?php if ( 'none' !== $settings['toggle_text']) :
|
||||
if ( 'price' == $settings['toggle_text'] ) { ?>
|
||||
<span class="wpr-mini-cart-btn-price">
|
||||
<?php echo $sub_total; ?>
|
||||
</span>
|
||||
<?php } else { ?>
|
||||
<span class="wpr-mini-cart-btn-text">
|
||||
<?php esc_html_e( $settings['toggle_title'], 'wpr-addons' ); ?>
|
||||
</span>
|
||||
<?php }
|
||||
endif; ?>
|
||||
<span class="wpr-mini-cart-btn-icon" <?php echo $counter_attr; ?>>
|
||||
<i class="<?php echo esc_attr( $icon_class ) ?>">
|
||||
<?php
|
||||
if ( \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_font_icon_svg' ) ) {
|
||||
$this->render_svg_inline_icons($settings);
|
||||
}
|
||||
?>
|
||||
<span class="wpr-mini-cart-icon-count <?php echo $product_count ? '' : 'wpr-mini-cart-icon-count-hidden'; ?>">
|
||||
<span><?php echo $product_count ?></span>
|
||||
</span>
|
||||
</i>
|
||||
</span>
|
||||
</a>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render_close_cart_icon () {}
|
||||
|
||||
public static function render_mini_cart($settings) {}
|
||||
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
$this->add_render_attribute(
|
||||
'mini_cart_attributes',
|
||||
[
|
||||
'data-animation' => (defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && isset($settings['mini_cart_entrance_speed'])) ? $settings['mini_cart_entrance_speed'] : ''
|
||||
]
|
||||
);
|
||||
|
||||
echo '<div class="wpr-mini-cart-wrap woocommerce"' . $this->get_render_attribute_string( 'mini_cart_attributes' ) . '>';
|
||||
echo '<span class="wpr-mini-cart-inner">';
|
||||
$this->render_mini_cart_toggle($settings);
|
||||
if ( 'none' !== $settings['mini_cart_style'] ) {
|
||||
$this->render_mini_cart($settings);
|
||||
}
|
||||
echo '</span>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductNotice;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-notice';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Notice', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+529
@@ -0,0 +1,529 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductNotice\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Text_Shadow;
|
||||
use Elementor\Group_Control_Box_Shadow;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Notice extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-notice';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Notice', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-woocommerce-notices';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product notice', 'product', 'notice', 'woocommerce notice', 'message', 'woocommerce message' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
public function get_script_depends() {
|
||||
return ['wc-add-to-cart', 'wc-add-to-cart-variation', 'wc-single-product'];
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_notice_styles',
|
||||
[
|
||||
'label' => esc_html__( 'Notice', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_notice_widget_info',
|
||||
[
|
||||
'raw' => esc_html__('This widget is permanently visible only in editor for easy customization, as for live pages it appears when invoked by an action (Product Added To Cart for example)', 'wpr-addons'),
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'content_classes' => 'elementor-descriptor',
|
||||
'separator' => 'none'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'notice_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FFFFFF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-message' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .woocommerce-info' => 'color: {{VALUE}}',
|
||||
'{{WRAPPER}} .woocommerce-error' => 'color: {{VALUE}}'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'notice_bg_color',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-message' => 'background-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .woocommerce-info' => 'background-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .woocommerce-error' => 'background-color: {{VALUE}}'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'success_notice_accent_color',
|
||||
[
|
||||
'label' => esc_html__( 'Success Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FFFFFF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-message' => 'border-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .woocommerce-message::before' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'info_notice_accent_color',
|
||||
[
|
||||
'label' => esc_html__( 'Info Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#30B5FF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-info' => 'border-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .woocommerce-info::before' => 'color: {{VALUE}}'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'error_notice_accent_color',
|
||||
[
|
||||
'label' => esc_html__( 'Error Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FF19FD',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-error' => 'border-color: {{VALUE}}',
|
||||
'{{WRAPPER}} .woocommerce-error::before' => 'color: {{VALUE}}'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'notice_typography',
|
||||
'label' => esc_html__( 'Typography', 'wpr-addons' ),
|
||||
'selector' => '{{WRAPPER}} .woocommerce-message, {{WRAPPER}} .woocommerce-info, {{WRAPPER}} .woocommerce-error',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '14',
|
||||
'unit' => 'px'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'notice_icon_size',
|
||||
[
|
||||
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px'],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 18,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-message::before' => 'font-size: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .woocommerce-error::before' => 'font-size: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .woocommerce-info::before' => 'font-size: {{SIZE}}px;'
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'notice_border_type',
|
||||
[
|
||||
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
|
||||
'double' => esc_html__( 'Double', 'wpr-addons' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
|
||||
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'solid',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-message' => 'border-style: {{VALUE}};',
|
||||
'{{WRAPPER}} .woocommerce-info' => 'border-style: {{VALUE}};',
|
||||
'{{WRAPPER}} .woocommerce-error' => 'border-style: {{VALUE}};'
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'notice_border_width',
|
||||
[
|
||||
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 1,
|
||||
'right' => 1,
|
||||
'bottom' => 1,
|
||||
'left' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-message' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'notice_border_type!' => 'none'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'notice_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => 0,
|
||||
'right' => 0,
|
||||
'bottom' => 0,
|
||||
'left' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-message' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'notice_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 13,
|
||||
'right' => 25,
|
||||
'bottom' => 13,
|
||||
'left' => 25,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-message' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} calc({{LEFT}}{{UNIT}} + {{notice_icon_size.SIZE}}px + 20px);',
|
||||
'{{WRAPPER}} .woocommerce-error' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} calc({{LEFT}}{{UNIT}} + {{notice_icon_size.SIZE}}px + 20px);',
|
||||
'{{WRAPPER}} .woocommerce-info' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} calc({{LEFT}}{{UNIT}} + {{notice_icon_size.SIZE}}px + 20px);',
|
||||
'{{WRAPPER}} .woocommerce-message::before' => 'top: {{TOP}}{{UNIT}}; left: {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .woocommerce-error::before' => 'top: {{TOP}}{{UNIT}}; left: {{LEFT}}{{UNIT}};',
|
||||
'{{WRAPPER}} .woocommerce-info::before' => 'top: {{TOP}}{{UNIT}}; left: {{LEFT}}{{UNIT}};'
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_style_btn',
|
||||
[
|
||||
'label' => esc_html__( 'Button', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->start_controls_tabs( 'tabs_btn_style' );
|
||||
|
||||
$this->start_controls_tab(
|
||||
'tab_btn_normal',
|
||||
[
|
||||
'label' => esc_html__( 'Normal', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#696969',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_bg_color',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FFFFFF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button' => 'background-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_border_color',
|
||||
[
|
||||
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#E8E8E8',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button' => 'border-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'btn_box_shadow',
|
||||
'selector' => '{{WRAPPER}} .woocommerce-notices-wrapper a.button',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'btn_typography',
|
||||
'selector' => '{{WRAPPER}} .woocommerce-notices-wrapper a.button',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '15',
|
||||
'unit' => 'px',
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_transition_duration',
|
||||
[
|
||||
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 0.5,
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
'step' => 0.1,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button' => 'transition-duration: {{VALUE}}s',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->start_controls_tab(
|
||||
'tab_btn_hover',
|
||||
[
|
||||
'label' => esc_html__( 'Hover', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#696969',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button:hover' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_bg_color_hover',
|
||||
[
|
||||
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FFFFFF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button:hover' => 'background-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_border_color_hr',
|
||||
[
|
||||
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button:hover' => 'border-color: {{VALUE}}',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'btn_box_shadow_hr',
|
||||
'selector' => '{{WRAPPER}} .woocommerce-notices-wrapper a.button:hover',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_tab();
|
||||
|
||||
$this->end_controls_tabs();
|
||||
|
||||
$this->add_control(
|
||||
'btn_border_type',
|
||||
[
|
||||
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
|
||||
'double' => esc_html__( 'Double', 'wpr-addons' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
|
||||
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'none',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button' => 'border-style: {{VALUE}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_border_width',
|
||||
[
|
||||
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 1,
|
||||
'right' => 1,
|
||||
'bottom' => 1,
|
||||
'left' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'btn_border_type!' => 'none',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'btn_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => 0,
|
||||
'right' => 0,
|
||||
'bottom' => 0,
|
||||
'left' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'btn_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 10,
|
||||
'right' => 30,
|
||||
'bottom' => 10,
|
||||
'left' => 30,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-notices-wrapper a.button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, Controls_Manager::TAB_STYLE );
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
|
||||
echo '<div class="wpr-checkout-notice">';
|
||||
if (\Elementor\Plugin::$instance->editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode()) { ?>
|
||||
<div class="woocommerce-notices-wrapper">
|
||||
<div class="woocommerce-message" role="alert">
|
||||
<a href="http://localhost/royal-wp/cart/" tabindex="1" class="button wc-forward">View cart</a> “V-Neck T-Shirt” has been added to your cart.
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="woocommerce-notices-wrapper">
|
||||
<div class="woocommerce-Message woocommerce-Message--info woocommerce-info">
|
||||
<a class="woocommerce-Button button" href="http://localhost/royal-wp/shop/"> Browse products</a> No downloads available yet.
|
||||
</div>
|
||||
</div>
|
||||
<div class="woocommerce-notices-wrapper">
|
||||
<ul class="woocommerce-error" role="alert">
|
||||
<li data-id="account_first_name">
|
||||
<strong>First name</strong> is a required field.
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
<?php } else {
|
||||
// echo is_single() ? wc_print_notices() : '';
|
||||
echo is_single() ? woocommerce_output_all_notices() : '';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductPrice;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-price';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Price', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+216
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductPrice\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Text_Shadow;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Price extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-price';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Price', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-product-price';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-price', 'product', 'price' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_product_price',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'product_price_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'left',
|
||||
'label_block' => false,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => __( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => __( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => __( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-price' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'after'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_price_tag',
|
||||
[
|
||||
'label' => esc_html__( 'Sale Price Display', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'inline',
|
||||
'options' => [
|
||||
'inline' => esc_html__( 'Inline', 'wpr-addons' ),
|
||||
'separate' => esc_html__( 'Separate', 'wpr-addons' ),
|
||||
],
|
||||
'prefix_class' => 'wpr-product-price-'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
|
||||
|
||||
// Styles ====================
|
||||
// Section: Price ------------
|
||||
$this->start_controls_section(
|
||||
'section_style_price',
|
||||
[
|
||||
'label' => esc_html__( 'Price', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'price_color',
|
||||
[
|
||||
'label' => esc_html__( 'Normal Price Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-price' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'price_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-product-price',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '25',
|
||||
'unit' => 'px',
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'price_sale_color',
|
||||
[
|
||||
'label' => esc_html__( 'Sale Price Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#A3A3A3',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-price del' => 'color: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'price_sale_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-product-price del',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '18',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'price_sale_spacing',
|
||||
[
|
||||
'label' => __( 'Distance', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'default' => [
|
||||
'size' => 10,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 30,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.wpr-product-price-inline .wpr-product-price ins' => 'margin-left: {{SIZE}}px',
|
||||
'{{WRAPPER}}.wpr-product-price-separate .wpr-product-price ins' => 'margin-top: {{SIZE}}px',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
// Get Settings
|
||||
$settings = $this->get_settings();
|
||||
|
||||
// Get Product
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( ! $product ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Output
|
||||
echo '<div class="wpr-product-price">';
|
||||
echo $product->get_price_html();
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductRating;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-rating';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Rating', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductRating\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Rating extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-rating';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Rating', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-product-rating';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-rating', 'product', 'rating' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_product_rating',
|
||||
[
|
||||
'label' => esc_html__( 'Styles', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_layout',
|
||||
[
|
||||
'label' => esc_html__( 'Layout', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'flex' => esc_html__('Horizontal', 'wpr-addons'),
|
||||
'block' => esc_html__('Vertical', 'wpr-addons'),
|
||||
],
|
||||
'prefix_class' => 'wpr-product-rating-',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-rating' => 'display: {{VALUE}}; align-items: center;'
|
||||
],
|
||||
'default' => 'flex',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_show_text',
|
||||
[
|
||||
'label' => esc_html__( 'Show Text', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'prefix_class' => 'wpr-pr-show-text-'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'product_rating_alignment',
|
||||
[
|
||||
'label' => esc_html__('Alignment', 'wpr-addons'),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__('Left', 'wpr-addons'),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__('Center', 'wpr-addons'),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__('Right', 'wpr-addons'),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
]
|
||||
],
|
||||
'prefix_class' => 'wpr-product-rating-',
|
||||
'default' => 'left',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.wpr-product-rating-block .wpr-woo-rating' => 'text-align: {{VALUE}};',
|
||||
'{{WRAPPER}}.wpr-product-rating-block .woocommerce-review-link' => 'text-align: {{VALUE}};',
|
||||
'{{WRAPPER}}.wpr-product-rating-flex .wpr-product-rating' => 'justify-content: {{VALUE}};'
|
||||
],
|
||||
'separator' => 'after',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#ffd726',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-woo-rating i:before' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_unmarked_color',
|
||||
[
|
||||
'label' => esc_html__( 'Unmarked Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#D2CDCD',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-woo-rating i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-woo-rating svg' => 'fill: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_text_color',
|
||||
[
|
||||
'label' => esc_html__( 'Text Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#787878',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} a.woocommerce-review-link' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_text_color_hover',
|
||||
[
|
||||
'label' => esc_html__( 'Text Hover Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#787878',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} a.woocommerce-review-link:hover' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'product_rating_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-product-rating .woocommerce-review-link',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '13',
|
||||
'unit' => 'px',
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_tr_duration',
|
||||
[
|
||||
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 0.1,
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
'step' => 0.1,
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-rating .woocommerce-review-link' => 'transition-duration: {{VALUE}}s;'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_size',
|
||||
[
|
||||
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => ['px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 20,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-woo-rating i' => 'font-size: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-woo-rating svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};'
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_gutter',
|
||||
[
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'label' => esc_html__( 'Icon Gutter', 'wpr-addons' ),
|
||||
'size_units' => [ 'px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 25,
|
||||
]
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 2,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-woo-rating i' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}} .wpr-woo-rating span' => 'margin-left: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_rating_spacing',
|
||||
[
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'label' => esc_html__( 'Label Distance', 'wpr-addons' ),
|
||||
'size_units' => [ 'px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 25,
|
||||
]
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 8,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.wpr-product-rating-flex .wpr-product-rating a.woocommerce-review-link' => 'margin-left: {{SIZE}}{{UNIT}};',
|
||||
'{{WRAPPER}}.wpr-product-rating-block .wpr-product-rating a.woocommerce-review-link' => 'margin-top: {{SIZE}}{{UNIT}}; display: block;',
|
||||
],
|
||||
'separator' => 'after'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, Controls_Manager::TAB_STYLE );
|
||||
}
|
||||
|
||||
public function render_product_rating( $settings ) {
|
||||
global $product;
|
||||
|
||||
// If NOT a Product
|
||||
if ( is_null( $product ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rating_count = $product->get_rating_count();
|
||||
$rating_amount = floatval( $product->get_average_rating() );
|
||||
$round_rating = (int)$rating_amount;
|
||||
$rating_icon = '☆';
|
||||
|
||||
echo '<div class="wpr-woo-rating">';
|
||||
|
||||
for ( $i = 1; $i <= 5; $i++ ) {
|
||||
if ( $i <= $rating_amount ) {
|
||||
echo '<i class="wpr-rating-icon-full">'. $rating_icon .'</i>';
|
||||
} elseif ( $i === $round_rating + 1 && $rating_amount !== $round_rating ) {
|
||||
echo '<i class="wpr-rating-icon-'. ( $rating_amount - $round_rating ) * 10 .'">'. $rating_icon .'</i>';
|
||||
} else {
|
||||
echo '<i class="wpr-rating-icon-empty">'. $rating_icon .'</i>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
// Another option
|
||||
// $rating = $product->get_average_rating();
|
||||
// $count = $product->get_rating_count();
|
||||
// echo wc_get_rating_html( $rating, $count );
|
||||
|
||||
?>
|
||||
|
||||
<a href="#reviews" class="woocommerce-review-link" rel="nofollow">
|
||||
(<?php printf( _n( '%s customer review', '%s customer reviews', 10, 'wpr-addons' ), '<span class="count">' . esc_html( $rating_count ) . '</span>' ); ?>)
|
||||
</a>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
// Get Settings
|
||||
$settings = $this->get_settings_for_display();
|
||||
global $product;
|
||||
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( empty( $product ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
setup_postdata( $product->get_id() );
|
||||
|
||||
echo '<div class="wpr-product-rating">';
|
||||
$this->render_product_rating($settings);
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductSalesBadge;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-sales-badge';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_SalesBadge', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductSalesBadge\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Group_Control_Box_Shadow;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_SalesBadge extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-sales-badge';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Sales Badge', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-post-info';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-sales-badge', 'product', 'sales-badge', 'sales', 'badge' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_product_sales_badge_styles',
|
||||
[
|
||||
'label' => esc_html__( 'Styles', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'sales_badge_text',
|
||||
[
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'label' => esc_html__( 'Sale Badge Text', 'wpr-addons' ),
|
||||
'default' => 'Sale!',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'sales_badge_alignment',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'left',
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-sales-badge' => 'text-align: {{VALUE}};',
|
||||
],
|
||||
'separator' => 'after'
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'sales_badge_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FFFFFF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-sales-badge span' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'sales_badge_background',
|
||||
[
|
||||
'label' => esc_html__( 'Background color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-sales-badge span' => 'background-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'sales_border_color',
|
||||
[
|
||||
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FFFFFF',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-sales-badge span' => 'border-color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'sales_badge_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-product-sales-badge span',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '16',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
'text_transform' => [
|
||||
'default' => 'uppercase',
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Box_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'sales_badge_box_shadow',
|
||||
'selector' => '{{WRAPPER}} .wpr-product-sales-badge span',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'sales_badge_padding',
|
||||
[
|
||||
'label' => esc_html__( 'Padding', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 3,
|
||||
'right' => 20,
|
||||
'bottom' => 3,
|
||||
'left' => 20,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-sales-badge span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'sales_badge_border_type',
|
||||
[
|
||||
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'none' => esc_html__( 'None', 'wpr-addons' ),
|
||||
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
|
||||
'double' => esc_html__( 'Double', 'wpr-addons' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
|
||||
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'none',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-sales-badge span' => 'border-style: {{VALUE}};',
|
||||
],
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'sales_badge_border_width',
|
||||
[
|
||||
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px' ],
|
||||
'default' => [
|
||||
'top' => 1,
|
||||
'right' => 1,
|
||||
'bottom' => 1,
|
||||
'left' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-sales-badge span' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'sales_badge_border_type!' => 'none',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'sales_badge_border_radius',
|
||||
[
|
||||
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'default' => [
|
||||
'top' => 0,
|
||||
'right' => 0,
|
||||
'bottom' => 0,
|
||||
'left' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-sales-badge span'=> 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, Controls_Manager::TAB_STYLE );
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
global $product;
|
||||
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( empty( $product ) || !$product->is_on_sale() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post = get_post( $product->get_id() );
|
||||
setup_postdata( $product->get_id() );
|
||||
|
||||
echo '<div class="wpr-product-sales-badge">';
|
||||
echo apply_filters( 'woocommerce_sale_flash', '<span>' . $settings['sales_badge_text'] . '</span>', $post, $product );
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductStock;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-stock';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Stock', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+414
@@ -0,0 +1,414 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductStock\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Group_Control_Box_Shadow;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Stock extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-stock';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Stock', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-product-stock';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'royal', 'product-stock', 'product', 'stock' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
$this->start_controls_section(
|
||||
'section_product_stock',
|
||||
[
|
||||
'label' => esc_html__( 'Settings', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'in_stock_heading',
|
||||
[
|
||||
'label' => esc_html__( 'In Stock', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'in_stock_availability_text',
|
||||
[
|
||||
'label' => esc_html__( 'Text', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'placeholder' => esc_html__( 'In Stock', 'wpr-addons' ),
|
||||
'default' => esc_html__( 'In Stock', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_in_stock_icon',
|
||||
[
|
||||
'label' => esc_html__('Select Icon', 'wpr-addons'),
|
||||
'type' => Controls_Manager::ICONS,
|
||||
'skin' => 'inline',
|
||||
'label_block' => false,
|
||||
'default' => [
|
||||
'value' => 'fas fa-check-circle',
|
||||
'library' => 'fa-solid',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_in_stock_color',
|
||||
[
|
||||
'label' => esc_html__('Icon Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#333333',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock .in-stock i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-stock .in-stock svg' => 'fill: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_in_stock_text_color',
|
||||
[
|
||||
'label' => esc_html__('Text Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#333333',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock .in-stock' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'out_of_stock_heading',
|
||||
[
|
||||
'label' => esc_html__( 'Out Of Stock', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_out_of_stock_icon',
|
||||
[
|
||||
'label' => esc_html__('Select Icon', 'wpr-addons'),
|
||||
'type' => Controls_Manager::ICONS,
|
||||
'skin' => 'inline',
|
||||
'label_block' => false,
|
||||
'default' => [
|
||||
'value' => 'fas fa-times-circle',
|
||||
'library' => 'fa-solid',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'out_of_stock_availability_text',
|
||||
[
|
||||
'label' => esc_html__( 'Text', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'placeholder' => esc_html__( 'Out of Stock', 'wpr-addons' ),
|
||||
'default' => esc_html__( 'Out of Stock', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_out_of_stock_color',
|
||||
[
|
||||
'label' => esc_html__('Icon Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#605BE5',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock .out-of-stock i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-stock .out-of-stock svg' => 'fill: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_out_of_stock_text_color',
|
||||
[
|
||||
'label' => esc_html__('Text Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#333333',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock .out-of-stock' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'backorder_heading',
|
||||
[
|
||||
'label' => esc_html__( 'Available On Backorder', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'backorder_availability_text',
|
||||
[
|
||||
'label' => esc_html__( 'Text', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'placeholder' => esc_html__( 'On Backorder', 'wpr-addons' ),
|
||||
'default' => esc_html__( 'On Backorder', 'wpr-addons' ),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_available_on_backorder_icon',
|
||||
[
|
||||
'label' => esc_html__('Select Icon', 'wpr-addons'),
|
||||
'type' => Controls_Manager::ICONS,
|
||||
'skin' => 'inline',
|
||||
'label_block' => false,
|
||||
'default' => [
|
||||
'value' => 'fas fa-shopping-cart',
|
||||
'library' => 'fa-solid',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_available_on_backorder_color',
|
||||
[
|
||||
'label' => esc_html__('Icon Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#FF4F40',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock .available-on-backorder i' => 'color: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-stock .available-on-backorder svg' => 'fill: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_available_on_backorder_text_color',
|
||||
[
|
||||
'label' => esc_html__('Text Color', 'wpr-addons'),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#333333',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock .available-on-backorder' => 'color: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'product_svg_size',
|
||||
[
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'label' => esc_html__( 'SVG Size', 'wpr-addons' ),
|
||||
'size_units' => [ 'px' ],
|
||||
'separator' => 'before',
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
]
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 13,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock svg' => 'width: {{SIZE}}px; height: {{SIZE}}px;',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_stock_vertical_align',
|
||||
[
|
||||
'label' => esc_html__( 'Vertical Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'top' => esc_html__( 'Top', 'wpr-addons' ),
|
||||
'middle' => esc_html__( 'Middle', 'wpr-addons' ),
|
||||
'bottom' => esc_html__( 'Bottom', 'wpr-addons' ),
|
||||
'text-top' => esc_html__( 'Text Top', 'wpr-addons' ),
|
||||
'text-bottom' => esc_html__( 'Text Bottom', 'wpr-addons' ),
|
||||
],
|
||||
'default' => 'text-bottom',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock-icon' => 'vertical-align: {{VALUE}};',
|
||||
'{{WRAPPER}} .wpr-product-stock-icon svg' => 'vertical-align: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'product_icon_gutter',
|
||||
[
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'label' => esc_html__( 'Spacing', 'wpr-addons' ),
|
||||
'size_units' => [ 'px' ],
|
||||
'separator' => 'before',
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 25,
|
||||
]
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
'size' => 5,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock .in-stock i' => 'margin-right: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .wpr-product-stock .out-of-stock i' => 'margin-right: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .wpr-product-stock .available-on-backorder i' => 'margin-right: {{SIZE}}px;',
|
||||
'{{WRAPPER}} .wpr-product-stock svg' => 'margin-right: {{SIZE}}px;',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'product_stock_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => false,
|
||||
'default' => 'left',
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-stock p' => 'text-align: {{VALUE}};',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'product_stock_typography',
|
||||
'label' => esc_html__('Typography', 'wpr-addons'),
|
||||
'selector' => '{{WRAPPER}} .wpr-product-stock p',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_family' => [
|
||||
'default' => '',
|
||||
],
|
||||
'font_size' => [
|
||||
'label' => esc_html__('Font Size (px)', 'wpr-addons'),
|
||||
'default' => [
|
||||
'size' => '13',
|
||||
'unit' => 'px'
|
||||
],
|
||||
'size_units' => ['px'],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, Controls_Manager::TAB_STYLE );
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
global $product;
|
||||
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( empty( $product ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
setup_postdata( $product->get_id() );
|
||||
|
||||
$icon = '';
|
||||
$stock_status = $product->get_stock_status();
|
||||
$availability = $product->get_availability();
|
||||
|
||||
if ( 'instock' == $stock_status ) {
|
||||
$icon = isset($settings['product_in_stock_icon']) ? $settings['product_in_stock_icon'] : '';
|
||||
} elseif ( 'outofstock' == $stock_status ) {
|
||||
$icon = isset($settings['product_out_of_stock_icon']) ? $settings['product_out_of_stock_icon'] : '';
|
||||
} elseif ( 'onbackorder' == $stock_status ) {
|
||||
$icon = isset($settings['product_available_on_backorder_icon']) ? $settings['product_available_on_backorder_icon'] : '';
|
||||
}
|
||||
|
||||
if ( $product->is_on_backorder() ) {
|
||||
$stock_html = $availability['availability'] ? $availability['availability'] : esc_html__($settings['backorder_availability_text'], 'wpr-addons');
|
||||
} elseif ( $product->is_in_stock() ) {
|
||||
$stock_html = $availability['availability'] ? $availability['availability'] : esc_html__($settings['in_stock_availability_text'], 'wpr-addons');
|
||||
} else {
|
||||
$stock_html = $availability['availability'] ? $availability['availability'] : esc_html__($settings['out_of_stock_availability_text'], 'wpr-addons');
|
||||
}
|
||||
|
||||
echo '<div class="wpr-product-stock">';
|
||||
echo '<p class="' . esc_attr($availability['class']) . '">';
|
||||
|
||||
if(!empty($icon)) {
|
||||
if ( \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_font_icon_svg' ) ) {
|
||||
ob_start();
|
||||
\Elementor\Icons_Manager::render_icon($icon, ['aria-hidden' => 'true']);
|
||||
$icon_html = ob_get_clean();
|
||||
|
||||
echo '<span class="wpr-product-stock-icon">';
|
||||
echo $icon_html;
|
||||
echo '</span>';
|
||||
} else {
|
||||
\Elementor\Icons_Manager::render_icon($icon, ['aria-hidden' => 'true']);
|
||||
}
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_stock_html', $stock_html, wp_kses_post($availability['availability']), $product );
|
||||
|
||||
echo '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductTabs;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-tabs';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Tabs', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+2208
File diff suppressed because it is too large
Load Diff
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductTitle;
|
||||
|
||||
use WprAddons\Base\Module_Base;
|
||||
|
||||
class Module extends Module_Base {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// This is here for extensibility purposes - go to town and make things happen!
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-title';
|
||||
}
|
||||
|
||||
public function get_widgets() {
|
||||
return [
|
||||
'Wpr_Product_Title', // This should match the widget/element class.
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
namespace WprAddons\Modules\ThemeBuilder\Woocommerce\ProductTitle\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Group_Control_Text_Shadow;
|
||||
use Elementor\Group_Control_Text_Stroke;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
|
||||
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class Wpr_Product_Title extends Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-product-title';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Product Title', 'wpr-addons' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'wpr-icon eicon-product-title';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return Utilities::show_theme_buider_widget_on('product_single') ? [ 'wpr-woocommerce-builder-widgets' ] : [];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'woocommerce', 'product-title', 'product', 'title' ];
|
||||
}
|
||||
|
||||
public function has_widget_inner_wrapper(): bool {
|
||||
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
|
||||
// Tab: Content ==============
|
||||
// Section: General ----------
|
||||
$this->start_controls_section(
|
||||
'section_product_title',
|
||||
[
|
||||
'label' => esc_html__( 'General', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'product_title_tag',
|
||||
[
|
||||
'label' => esc_html__( 'Title HTML Tag', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'h1' => 'H1',
|
||||
'h2' => 'H2',
|
||||
'h3' => 'H3',
|
||||
'h4' => 'H4',
|
||||
'h5' => 'H5',
|
||||
'h6' => 'H6',
|
||||
'div' => 'div',
|
||||
'span' => 'span',
|
||||
'P' => 'p'
|
||||
],
|
||||
'default' => 'h1',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'product_title_align',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'left',
|
||||
'label_block' => false,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => __( 'Left', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => __( 'Center', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => __( 'Right', 'wpr-addons' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-title' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
'separator' => 'before'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section(); // End Controls Section
|
||||
|
||||
// Section: Request New Feature
|
||||
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
|
||||
|
||||
// Styles ====================
|
||||
// Section: Title ------------
|
||||
$this->start_controls_section(
|
||||
'section_style_title',
|
||||
[
|
||||
'label' => esc_html__( 'Title', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_STYLE,
|
||||
'show_label' => false,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'title_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#222222',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .wpr-product-title' => 'color: {{VALUE}}',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Typography::get_type(),
|
||||
[
|
||||
'name' => 'title_typography',
|
||||
'selector' => '{{WRAPPER}} .wpr-product-title',
|
||||
'fields_options' => [
|
||||
'typography' => [
|
||||
'default' => 'custom',
|
||||
],
|
||||
'font_size' => [
|
||||
'default' => [
|
||||
'size' => '35',
|
||||
'unit' => 'px',
|
||||
],
|
||||
],
|
||||
'letter_spacing' => [
|
||||
'default' => [
|
||||
'size' => '1.1'
|
||||
]
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Text_Shadow::get_type(),
|
||||
[
|
||||
'name' => 'title_shadow',
|
||||
'selector' => '{{WRAPPER}} .wpr-product-title',
|
||||
'separator' => 'after',
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_group_control(
|
||||
Group_Control_Text_Stroke::get_type(),
|
||||
[
|
||||
'name' => 'text_stroke',
|
||||
'selector' => '{{WRAPPER}} .wpr-product-title',
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
// Get Settings
|
||||
$settings = $this->get_settings();
|
||||
|
||||
// Get Product
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( ! $product ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tags_whitelist = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p'];
|
||||
$product_title_tag = Utilities::validate_html_tags_wl( $settings['product_title_tag'], 'h1', $tags_whitelist );
|
||||
|
||||
// Output
|
||||
echo '<'. $product_title_tag .' class="wpr-product-title">';
|
||||
echo $product->get_title();
|
||||
echo '</'. $product_title_tag .'>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+429
@@ -0,0 +1,429 @@
|
||||
<?php
|
||||
|
||||
use Elementor\Controls_Manager;
|
||||
use WprAddons\Classes\Utilities;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Wpr_Theme_Builder extends Elementor\Core\Base\Document {
|
||||
|
||||
public function get_name() {
|
||||
return 'wpr-theme-builder';
|
||||
}
|
||||
|
||||
public static function get_type() {
|
||||
return 'wpr-theme-builder';
|
||||
}
|
||||
|
||||
public static function get_title() {
|
||||
return esc_html__( 'WPR Theme Builder', 'wpr-addons' );
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
// Get Available Post Types
|
||||
$post_types = Utilities::get_custom_types_of( 'post', false );
|
||||
|
||||
// Get Available Taxonomies
|
||||
$post_taxonomies = Utilities::get_custom_types_of( 'tax', false );
|
||||
|
||||
$this->start_controls_section(
|
||||
'preview_settings',
|
||||
[
|
||||
'label' => esc_html__( 'Preview Settings', 'wpr-addons' ),
|
||||
'tab' => Controls_Manager::TAB_SETTINGS,
|
||||
]
|
||||
);
|
||||
|
||||
$default_archives = [
|
||||
'archive/posts' => esc_html__( 'Posts Archive', 'wpr-addons' ),
|
||||
'product_archive/products' => esc_html__( 'Products Archive', 'wpr-addons' ),
|
||||
'product_archive/product_search' => esc_html__('Products Search', 'wpr-addons'),
|
||||
'archive/author' => esc_html__( 'Author Archive', 'wpr-addons' ),
|
||||
'archive/date' => esc_html__( 'Date Archive', 'wpr-addons' ),
|
||||
'archive/search' => esc_html__( 'Search Results', 'wpr-addons' ),
|
||||
];
|
||||
|
||||
$taxonomy_archives = $post_taxonomies;
|
||||
|
||||
// Add CPT to Default Archives
|
||||
foreach ($post_types as $post_type => $value) {
|
||||
if ( 'post' === $post_type || 'page' === $post_type || 'e-landing-page' === $post_type ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$default_archives['archive/'. $post_type] = $value .' '. esc_html__( 'Archive', 'wpr-addons' );
|
||||
}
|
||||
|
||||
$id = get_the_ID();
|
||||
$query = '';
|
||||
|
||||
if ( false !== $id ) {
|
||||
$template_type = get_post_meta( $id, '_wpr_template_type', true );
|
||||
$template_slug = get_post($id)->post_name;
|
||||
|
||||
if ( false !== strpos( $template_type, 'single' ) ) {
|
||||
if ( 0 === strpos( $template_type, 'single' ) ) {
|
||||
$conds = json_decode(get_option('wpr_single_conditions'));
|
||||
} else {
|
||||
$conds = json_decode(get_option('wpr_product_single_conditions'));
|
||||
}
|
||||
|
||||
if ( $template_slug == Utilities::get_template_slug($conds, 'single/posts', $id) ) {
|
||||
$query = 'post';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'product_single/product', $id) ) {
|
||||
$query = 'product';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'single/pages', $id) ) {
|
||||
$query = 'page';
|
||||
} else {
|
||||
foreach ($post_types as $post_type => $value) {
|
||||
if ( 'post' === $post_type || 'page' === $post_type ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $template_slug == Utilities::get_template_slug($conds, 'single/'. $post_type, $id) ) {
|
||||
$query = $post_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( 0 === strpos( $template_type, 'archive' ) ) {
|
||||
$conds = json_decode(get_option('wpr_archive_conditions'));
|
||||
} else {
|
||||
$conds = json_decode(get_option('wpr_product_archive_conditions'));
|
||||
}
|
||||
|
||||
if ( $template_slug == Utilities::get_template_slug($conds, 'archive/posts', $id) || $template_slug == Utilities::get_template_slug($conds, 'archive/all_archives', $id) ) {
|
||||
$query = 'archive/posts';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'archive/search', $id) ) {
|
||||
$query = 'archive/search';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'archive/author', $id) ) {
|
||||
$query = 'archive/author';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'archive/date', $id) ) {
|
||||
$query = 'archive/date';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'product_archive/products', $id) ) {
|
||||
$query = 'product_archive/products';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'product_archive/product_cat/all', $id) ) {
|
||||
$query = 'product_cat';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'product_archive/product_tag/all', $id) ) {
|
||||
$query = 'product_tag';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'product_archive/product_search') ) {
|
||||
$query = 'product_archive/product_search';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'archive/categories', $id) ) {
|
||||
$query = 'category';
|
||||
} elseif ( $template_slug == Utilities::get_template_slug($conds, 'archive/tags', $id) ) {
|
||||
$query = 'post_tag';
|
||||
} else {
|
||||
foreach ($post_types as $post_type => $value) {
|
||||
if ( 'post' === $post_type || 'page' === $post_type ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $template_slug == Utilities::get_template_slug($conds, 'archive/'. $post_type, $id) ) {
|
||||
$query = 'archive/'. $post_type;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($post_taxonomies as $tax => $value) {
|
||||
if ( 'category' === $tax || 'tag' === $tax ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $template_slug == Utilities::get_template_slug($conds, 'archive/'. $tax, $id) ) {
|
||||
$query = $tax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->add_control(
|
||||
'preview_source',
|
||||
[
|
||||
'label' => esc_html__( 'Preview Source', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => $query,
|
||||
'groups' => [
|
||||
'archive' => [
|
||||
'label' => __( 'Archives', 'wpr-addons' ),
|
||||
'options' => $default_archives + $taxonomy_archives,
|
||||
],
|
||||
'single' => [
|
||||
'label' => __( 'Singular', 'wpr-addons' ),
|
||||
'options' => $post_types
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$wp_users = Utilities::get_users();
|
||||
reset($wp_users);
|
||||
$first_user_id = key($wp_users);
|
||||
|
||||
$this->add_control(
|
||||
'preview_archive_author',
|
||||
[
|
||||
'label' => esc_html__( 'Select Author', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::SELECT2,
|
||||
'options' => Utilities::get_users(),
|
||||
'default' => $first_user_id,
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'preview_source' => 'archive/author'
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'preview_archive_search',
|
||||
[
|
||||
'label' => esc_html__( 'Search Keyword', 'wpr-addons' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'separator' => 'before',
|
||||
'default' => 'a',
|
||||
'condition' => [
|
||||
'preview_source' => 'archive/search',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
// Posts
|
||||
foreach ( $post_types as $slug => $title ) {
|
||||
$latest_post = get_posts('post_type='. $slug .'&numberposts=1');
|
||||
|
||||
$this->add_control(
|
||||
'preview_single_'. $slug,
|
||||
[
|
||||
'label' => 'Select '. $title,
|
||||
'type' => 'wpr-ajax-select2',
|
||||
// 'type' => Controls_Manager::SELECT2,
|
||||
'label_block' => true,
|
||||
'default' => !empty($latest_post) ? $latest_post[0]->ID : '',
|
||||
'options' => 'ajaxselect2/get_posts_by_post_type',
|
||||
// 'options' => Utilities::get_posts_by_post_type( $slug ),
|
||||
'query_slug' => $slug,
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'preview_source' => $slug,
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Taxonomies
|
||||
foreach ( $post_taxonomies as $slug => $title ) {
|
||||
if ( 'category' === $slug || 'post_tag' === $slug ) {
|
||||
$title = 'Post '. $title;
|
||||
}
|
||||
|
||||
$terms = get_terms( $slug, 'orderby=date&hide_empty=0&number=1' );
|
||||
|
||||
$this->add_control(
|
||||
'preview_archive_'. $slug,
|
||||
[
|
||||
'label' => 'Select '. $title,
|
||||
'type' => Controls_Manager::SELECT2,
|
||||
'label_block' => true,
|
||||
'default' => !empty($terms) ? $terms[0]->term_id : '',
|
||||
'options' => Utilities::get_terms_by_taxonomy( $slug ),
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'preview_source' => $slug,
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$this->add_control(
|
||||
'submit_preview_changes',
|
||||
[
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'raw' => '<div class="elementor-update-preview-button editor-wpr-preview-update"><span>Click the Publish Button, then Click the Apply Button</span><button class="elementor-button elementor-button-success" onclick="elementor.reloadPreview();">Apply</button></div>',
|
||||
'separator' => 'after'
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
// Default Document Settings
|
||||
parent::register_controls();
|
||||
}
|
||||
|
||||
public function get_tax_query_args( $tax, $terms ) {
|
||||
$terms = empty($terms) ? [ 'all' ] : $terms;
|
||||
|
||||
$args = [
|
||||
'tax_query' => [
|
||||
[
|
||||
'taxonomy' => $tax,
|
||||
'terms' => $terms,
|
||||
'field' => 'id',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
public function get_document_query_args() {
|
||||
$settings = $this->get_settings();
|
||||
$source = $settings['preview_source'];
|
||||
$args = false;
|
||||
|
||||
// Default Archives
|
||||
switch ( $source ) {
|
||||
case 'archive/posts':
|
||||
$args = [ 'post_type' => 'post' ];
|
||||
break;
|
||||
|
||||
case 'product_archive/products':
|
||||
$args = ['post_type' => 'product'];
|
||||
break;
|
||||
|
||||
case 'archive/author':
|
||||
$args = [ 'author' => $settings['preview_archive_author'] ];
|
||||
break;
|
||||
|
||||
case 'archive/search':
|
||||
$args = [ 's' => $settings['preview_archive_search'] ];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Custom Post Type Archives
|
||||
if ( strpos( $source, 'archive/' ) !== false ) {
|
||||
$post_type = str_replace( 'archive/', '', $source );
|
||||
$args = [ 'post_type' => $post_type ];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Taxonomy Archives
|
||||
foreach ( Utilities::get_custom_types_of( 'tax', false ) as $slug => $title ) {
|
||||
if ( $slug === $source ) {
|
||||
$args = $this->get_tax_query_args( $slug, $settings[ 'preview_archive_'. $slug ] );
|
||||
}
|
||||
}
|
||||
|
||||
// Singular Posts
|
||||
foreach ( Utilities::get_custom_types_of( 'post', false ) as $slug => $title ) {
|
||||
if ( $slug === $source ) {
|
||||
// Get Post
|
||||
$post = get_posts( [
|
||||
'post_type' => $source,
|
||||
'numberposts' => 1,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'suppress_filters' => false,
|
||||
] );
|
||||
|
||||
$args = [ 'post_type' => $source ];
|
||||
|
||||
$post_id = $settings[ 'preview_single_'. $slug ];
|
||||
|
||||
if ( ! empty( $post ) && '' === $post_id ) {
|
||||
$args['p'] = $post[0]->ID;
|
||||
} else {
|
||||
$args['p'] = $post_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default
|
||||
if ( false === $args ) {
|
||||
// Get Post
|
||||
$post = get_posts( [
|
||||
'post_type' => 'post',
|
||||
'numberposts' => 1,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'suppress_filters' => false,
|
||||
] );
|
||||
|
||||
$args = [ 'post_type' => 'post' ];
|
||||
|
||||
// Last Post for Single Pages
|
||||
if ( ! empty( $post ) ) {
|
||||
$args['p'] = $post[0]->ID;
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
public function switch_to_preview_query() {
|
||||
if ( 'wpr_templates' === get_post_type( get_the_ID() ) ) {
|
||||
$document = Elementor\Plugin::instance()->documents->get_doc_or_auto_save( get_the_ID() );
|
||||
Elementor\Plugin::instance()->db->switch_to_query( $document->get_document_query_args() );
|
||||
}
|
||||
}
|
||||
|
||||
public function get_content( $with_css = false ) {
|
||||
$this->switch_to_preview_query();
|
||||
|
||||
$content = parent::get_content( $with_css );
|
||||
|
||||
Elementor\Plugin::instance()->db->restore_current_query();
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function print_content() {
|
||||
$plugin = Plugin::elementor();
|
||||
|
||||
if ( $plugin->preview->is_preview_mode( $this->get_main_id() ) ) {
|
||||
echo ''. $plugin->preview->builder_wrapper( '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
} else {
|
||||
echo ''. $this->get_content(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
|
||||
public static function get_preview_as_default() {
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function get_preview_as_options() {
|
||||
return [];
|
||||
}
|
||||
|
||||
public function get_elements_raw_data( $data = null, $with_html_content = false ) {
|
||||
|
||||
$this->switch_to_preview_query();
|
||||
|
||||
$editor_data = parent::get_elements_raw_data( $data, $with_html_content );
|
||||
|
||||
Elementor\Plugin::instance()->db->restore_current_query();
|
||||
|
||||
return $editor_data;
|
||||
}
|
||||
|
||||
public function render_element( $data ) {
|
||||
|
||||
$this->switch_to_preview_query();
|
||||
|
||||
$render_html = parent::render_element( $data );
|
||||
|
||||
Elementor\Plugin::instance()->db->restore_current_query();
|
||||
|
||||
return $render_html;
|
||||
}
|
||||
|
||||
// Add Post Class to Single Pages
|
||||
public function get_container_attributes() {
|
||||
$attributes = parent::get_container_attributes();
|
||||
|
||||
if ( is_singular() ) { // Not 404
|
||||
$template_type = get_post_meta(get_the_ID(), '_wpr_template_type', true);
|
||||
$post_classes = get_post_class( '', get_the_ID() );
|
||||
|
||||
if ( 'product_single' === $template_type ) {
|
||||
array_push($post_classes, 'product');
|
||||
}
|
||||
|
||||
$attributes['class'] .= ' ' . implode( ' ', $post_classes );
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user