Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
home
/
getwphos
/
www
/
nycre
/
wp-content
/
plugins
/
mascot-core-realexa
/
cpt
/
blog
/
File Content:
widget.php
<?php namespace MascotCoreRealexa\Widgets\Blog; use Elementor\Widget_Base; use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Elementor Hello World * * Elementor widget for hello world. * * @since 1.0.0 */ class TM_Elementor_Blog extends Widget_Base { public function __construct($data = [], $args = null) { parent::__construct($data, $args); if( \Elementor\Plugin::$instance->preview->is_preview_mode() ) { $direction_suffix = is_rtl() ? '.rtl' : ''; wp_enqueue_style( 'tm-blog-style', MASCOT_CORE_REALEXA_ASSETS_URI . '/css/cpt/blog/blog-loader' . $direction_suffix . '.css' ); } } /** * Retrieve the widget name. * * @since 1.0.0 * * @access public * * @return string Widget name. */ public function get_name() { return 'tm-ele-blog'; } /** * Retrieve the widget title. * * @since 1.0.0 * * @access public * * @return string Widget title. */ public function get_title() { return esc_html__( 'Blog/News Grid', 'mascot-core-realexa' ); } /** * Retrieve the widget icon. * * @since 1.0.0 * * @access public * * @return string Widget icon. */ public function get_icon() { return 'tm-elementor-widget-icon'; } /** * Retrieve the list of categories the widget belongs to. * * Used to determine where to display the widget in the editor. * * Note that currently Elementor supports only one category. * When multiple categories passed, Elementor uses the first one. * * @since 1.0.0 * * @access public * * @return array Widget categories. */ public function get_categories() { return [ 'tm' ]; } /** * Retrieve the list of scripts the widget depended on. * * Used to set scripts dependencies required to run the widget. * * @since 1.0.0 * * @access public * * @return array Widget scripts dependencies. */ public function get_script_depends() { return [ 'mascot-core-hellojs' ]; } /** * Skins */ protected function register_skins() { $this->add_skin( new Skins\Skin_Style_Current_Theme1( $this ) ); $this->add_skin( new Skins\Skin_Style_Current_Theme2( $this ) ); $this->add_skin( new Skins\Skin_Style_Current_Theme3( $this ) ); $this->add_skin( new Skins\Skin_Style_Current_Theme4( $this ) ); } protected function get_supported_ids() { $supported_ids = []; $wp_query = new \WP_Query( array( 'post_type' => 'post', 'post_status' => 'publish' ) ); if ( $wp_query->have_posts() ) { while ( $wp_query->have_posts() ) { $wp_query->the_post(); $supported_ids[get_the_ID()] = get_the_title(); } } return $supported_ids; } public function get_supported_taxonomies() { $supported_taxonomies = []; $categories = get_terms( array( 'taxonomy' => 'category', 'hide_empty' => false, ) ); if( ! empty( $categories ) && ! is_wp_error( $categories ) ) { foreach ( $categories as $category ) { $supported_taxonomies[$category->term_id] = $category->name; } } return $supported_taxonomies; } /** * Register the widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @since 1.0.0 * * @access protected */ protected function register_controls() { $posts_array = mascot_core_realexa_get_post_list_array_by_post_type( 'post' ); $orderby_parameters_list1 = mascot_core_realexa_orderby_parameters_list(); $orderby_parameters_list2 = array( ); $orderby_parameters_list = array_merge( $orderby_parameters_list2, $orderby_parameters_list1 ); $post_meta_array = array( 'show-post-by-author' => esc_html__( 'Show Author', 'mascot-core-realexa' ), 'show-post-date' => esc_html__( 'Show Date', 'mascot-core-realexa' ), 'show-post-date-split' => esc_html__( 'Show Date Split', 'mascot-core-realexa' ), 'show-post-category' => esc_html__( 'Show Category', 'mascot-core-realexa' ), 'show-post-comments-count' => esc_html__( 'Show Comments Count', 'mascot-core-realexa' ), 'show-post-tag' => esc_html__( 'Show Tag', 'mascot-core-realexa' ), 'show-post-like-button' => esc_html__( 'Show Like Button', 'mascot-core-realexa' ) ); $this->start_controls_section( 'tm_general', [ 'label' => esc_html__( 'General', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'wow_appear_animation', [ 'label' => esc_html__( "Wow Appear Animation", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_animate_css_animation_list(), ] ); $this->add_control( 'wow_animation_delay', [ 'label' => esc_html__( 'Animation Delay', 'mascot-core-realexa' ) . ' (ms)', 'type' => Controls_Manager::NUMBER, 'default' => '', 'min' => 0, 'step' => 100, 'condition' => [ 'wow_appear_animation!' => '', ], 'render_type' => 'none', 'frontend_available' => true, ] ); $this->add_control( 'display_type', [ 'label' => esc_html__( "Display Type", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => [ 'grid' => esc_html__( 'Grid', 'mascot-core-realexa' ), 'masonry' => esc_html__( 'Masonry', 'mascot-core-realexa' ), 'masonry-tiles' => esc_html__( 'Masonry Tiles', 'mascot-core-realexa' ), 'carousel' => esc_html__( 'Carousel/Slider', 'mascot-core-realexa' ), 'basic' => esc_html__( 'Basic', 'mascot-core-realexa' ), 'floating-parallax' => esc_html__( 'Floating Parallax', 'mascot-core-realexa' ) ], 'default' => 'grid' ] ); $this->add_control( 'columns', [ 'label' => esc_html__( "Columns Layout", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ], 'default' => '3', 'condition' => [ 'display_type!' => array('carousel') ] ] ); //responsive grid layout mascot_core_realexa_elementor_grid_responsive_columns($this); $this->add_control( 'gutter', [ 'label' => esc_html__( "Gutter", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_isotope_gutter_list_elementor(), 'default' => 'gutter-10', 'condition' => [ 'display_type' => array('grid', 'masonry', 'masonry-tiles') ] ] ); $this->add_control( 'use_masonry_tiles_featured_image_size', [ 'label' => esc_html__( "Use Predefined Image Size in Masonry Mode", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SWITCHER, "description" => esc_html__( "You can select predefined image size from each items edit page. If you choose yes, then 'Featured Image Size' will not work", 'mascot-core-realexa' ), 'default' => 'yes', 'condition' => [ 'display_type' => array('masonry-tiles') ] ] ); $this->end_controls_section(); //Swiper Slider Options mascot_core_realexa_get_swiper_slider_arraylist( $this, 1, '', array('display_type' => array('carousel') ) ); mascot_core_realexa_get_swiper_slider_nav_arraylist( $this, 1, '', array('display_type' => array('carousel') ) ); mascot_core_realexa_get_swiper_slider_dots_arraylist( $this, 1, '', array('display_type' => array('carousel') ) ); $this->start_controls_section( 'query', [ 'label' => esc_html__( 'Query', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'total_items', [ 'label' => esc_html__( "Number of Items to Query from Database", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::TEXT, "description" => esc_html__( "How many items do you wish to show? Put -1 to show all. Default 3", 'mascot-core-realexa' ), 'default' => '3' ] ); $this->add_control( 'show_only_selected_single_post', [ 'label' => esc_html__( "Show Only Selected Single Item", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'no', ] ); $this->add_control( 'selected_single_post', [ 'label' => esc_html__( "Choose Single Item", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => $posts_array, 'condition' => [ 'show_only_selected_single_post' => array('yes') ] ] ); $this->add_control( 'ids', [ 'label' => __( 'Ids', 'mascot-core-realexa' ), 'type' => Controls_Manager::SELECT2, 'options' => $this->get_supported_ids(), 'label_block' => true, 'multiple' => true, ] ); $this->add_control( 'category', [ 'label' => __( 'Category', 'mascot-core-realexa' ), 'type' => Controls_Manager::SELECT2, 'options' => $this->get_supported_taxonomies(), 'label_block' => true, 'multiple' => true, ] ); $this->add_control( 'order_by', [ 'label' => esc_html__( "Order By", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => $orderby_parameters_list, ] ); $this->add_control( 'order', [ 'label' => esc_html__( "Order", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => [ 'DESC' => esc_html__( 'Descending', 'mascot-core-realexa' ), 'ASC' => esc_html__( 'Ascending', 'mascot-core-realexa' ), ], ] ); $this->end_controls_section(); //Content Options $this->start_controls_section( 'content', [ 'label' => esc_html__( 'All Items(Content) Show/Hide', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'show_featured_image', [ 'label' => esc_html__( "Show Featured Image", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes' ] ); $this->add_control( 'featured_image_size', [ 'label' => esc_html__( "Featured Image Size", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_get_available_image_sizes(), 'default' => 'post-thumbnail', 'condition' => [ 'show_featured_image' => array('yes') ] ] ); $this->add_control( 'show_title', [ 'label' => esc_html__( "Show Title", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes' ] ); $this->add_control( 'title_tag', [ 'label' => esc_html__( "Title Tag", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_heading_tag_list(), 'default' => 'h4', 'condition' => [ 'show_title' => array('yes') ] ] ); $this->add_control( 'show_excerpt', [ 'label' => esc_html__( "Show Excerpt", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes' ] ); $this->add_control( 'excerpt_length', [ 'label' => esc_html__( "Excerpt Length", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::TEXT, "description" => esc_html__( "Number of words to display", 'mascot-core-realexa' ), 'condition' => [ 'show_excerpt' => array('yes') ] ] ); $this->add_control( 'show_post_meta', [ 'label' => esc_html__( "Show Post Meta", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes' ] ); $this->add_control( 'post_meta_options', [ 'label' => esc_html__( "Choose Post Meta", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT2, 'options' => $post_meta_array, 'multiple' => true, 'default' => [ 'show-post-by-author', 'show-post-date' ], 'condition' => [ 'show_post_meta' => array('yes') ] ] ); $this->add_control( 'show_post_meta_over_featured_image', [ 'label' => esc_html__( "Show This Meta Over Thumbnail", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => $post_meta_array, 'default' => 'show-post-by-author', 'condition' => [ 'show_post_meta' => array('yes') ] ] ); $this->end_controls_section(); $this->start_controls_section( 'title_options_styling', [ 'label' => esc_html__( 'Title Styling', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_text_color', [ 'label' => esc_html__( "Text Color", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article .entry-title' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'title_text_color_hover', [ 'label' => esc_html__( "Text Color (Title Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article .entry-title:hover' => 'color: {{VALUE}};', '{{WRAPPER}} article .entry-title a:hover' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'title_text_color_item_hover', [ 'label' => esc_html__( "Text Color (Item Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article:hover .entry-title' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'title_theme_colored', [ 'label' => esc_html__( "Title Theme Colored", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article .entry-title' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_control( 'title_theme_colored_hover', [ 'label' => esc_html__( "Title Theme Colored (Title Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article .entry-title:hover' => 'color: var(--theme-color{{VALUE}});', '{{WRAPPER}} article .entry-title a:hover' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_control( 'title_theme_colored_item_hover', [ 'label' => esc_html__( "Title Theme Colored (Item Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article:hover .entry-title' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'label' => esc_html__( 'Typography', 'mascot-core-realexa' ), 'selector' => '{{WRAPPER}} article .entry-title', ] ); $this->add_responsive_control( 'title_margin', [ 'label' => esc_html__( 'Title Margin', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} article .entry-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'title_padding', [ 'label' => esc_html__( 'Title Padding', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} article .entry-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'excerpt_options_styling', [ 'label' => esc_html__( 'Excerpt Styling', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'excerpt_text_color', [ 'label' => esc_html__( "Text Color", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article .post-excerpt' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'excerpt_text_color_hover', [ 'label' => esc_html__( "Text Color (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article:hover .post-excerpt' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'excerpt_theme_colored', [ 'label' => esc_html__( "Text Theme Colored", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article .post-excerpt' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_control( 'excerpt_theme_colored_hover', [ 'label' => esc_html__( "Text Theme Colored (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article:hover .post-excerpt' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'excerpt_typography', 'label' => esc_html__( 'Typography', 'mascot-core-realexa' ), 'selector' => '{{WRAPPER}} article .post-excerpt', ] ); $this->add_responsive_control( 'excerpt_margin', [ 'label' => esc_html__( 'Text Margin', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} article .post-excerpt' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'excerpt_padding', [ 'label' => esc_html__( 'Text Padding', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} article .post-excerpt' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'meta_options_styling', [ 'label' => esc_html__( 'Post Meta Styling', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'meta_text_color', [ 'label' => esc_html__( "Text Color", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article .entry-meta *' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'meta_text_color_hover', [ 'label' => esc_html__( "Text Color (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article:hover .entry-meta *' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'meta_theme_colored', [ 'label' => esc_html__( "Text Theme Colored", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article .entry-meta *' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_control( 'meta_theme_colored_hover', [ 'label' => esc_html__( "Text Theme Colored (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article:hover .entry-meta *' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'meta_typography', 'label' => esc_html__( 'Typography', 'mascot-core-realexa' ), 'selector' => '{{WRAPPER}} article .entry-meta', ] ); $this->add_responsive_control( 'meta_margin', [ 'label' => esc_html__( 'Text Margin', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} article .entry-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'meta_padding', [ 'label' => esc_html__( 'Text Padding', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} article .entry-meta' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'icon_color_options', [ 'label' => esc_html__( 'Icon Color Options', 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'meta_icon_text_color', [ 'label' => esc_html__( "Icon Color", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article .entry-meta i' => 'color: {{VALUE}} !important;' ] ] ); $this->add_control( 'meta_icon_text_color_hover', [ 'label' => esc_html__( "Icon Color (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article:hover .entry-meta i' => 'color: {{VALUE}} !important;' ] ] ); $this->add_control( 'meta_icon_theme_colored', [ 'label' => esc_html__( "Icon Theme Colored", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article .entry-meta i' => 'color: var(--theme-color{{VALUE}}) !important;' ], ] ); $this->add_control( 'meta_icon_theme_colored_hover', [ 'label' => esc_html__( "Icon Theme Colored (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article:hover .entry-meta i' => 'color: var(--theme-color{{VALUE}}) !important;' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'single_meta_options_styling', [ 'label' => esc_html__( 'Single Meta Styling', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'single_meta_text_color', [ 'label' => esc_html__( "Text Color", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article .post-single-meta *' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'single_meta_text_color_hover', [ 'label' => esc_html__( "Text Color (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} article:hover .post-single-meta *' => 'color: {{VALUE}};' ] ] ); $this->add_control( 'single_meta_theme_colored', [ 'label' => esc_html__( "Text Theme Colored", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article .post-single-meta *' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_control( 'single_meta_theme_colored_hover', [ 'label' => esc_html__( "Text Theme Colored (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} article:hover .post-single-meta *' => 'color: var(--theme-color{{VALUE}});' ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'single_meta_typography', 'label' => esc_html__( 'Typography', 'mascot-core-realexa' ), 'selector' => '{{WRAPPER}} article .post-single-meta', ] ); $this->add_responsive_control( 'single_meta_margin', [ 'label' => esc_html__( 'Text Margin', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} article .post-single-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'single_meta_padding', [ 'label' => esc_html__( 'Text Padding', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} article .post-single-meta' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'content_wrapper_options_styling', [ 'label' => esc_html__( 'Wrapper Styling', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs('tabs_title_styling'); $this->start_controls_tab( 'tabs_content_wrapper_styling_normal', [ 'label' => esc_html__('Normal', 'mascot-core-realexa'), ] ); $this->add_control( 'content_wrapper_color_options', [ 'label' => esc_html__( 'BG Color Options', 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::HEADING, ] ); $this->add_responsive_control( 'content_wrapper_custom_bg_color', [ 'label' => esc_html__( "Custom Background Color", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .type-post .entry-content' => 'background-color: {{VALUE}};' ] ] ); $this->add_responsive_control( 'content_wrapper_theme_colored', [ 'label' => esc_html__( "Make BG Theme Colored", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} .type-post .entry-content' => 'background-color: var(--theme-color{{VALUE}});' ], ] ); $this->add_responsive_control( 'content_wrapper_margin', [ 'label' => esc_html__( 'Margin', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .type-post .entry-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'content_wrapper_padding', [ 'label' => esc_html__( 'Padding', 'mascot-core-realexa' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .type-post .entry-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tabs_content_wrapper_styling_hover', [ 'label' => esc_html__('Hover', 'mascot-core-realexa'), ] ); $this->add_responsive_control( 'content_wrapper_custom_bg_color_hover', [ 'label' => esc_html__( "Custom Background Color (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .type-post:hover .entry-content' => 'background-color: {{VALUE}};' ] ] ); $this->add_responsive_control( 'content_wrapper_theme_colored_hover', [ 'label' => esc_html__( "Make BG Theme Colored (Hover)", 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mascot_core_realexa_theme_color_list(), 'default' => '', 'selectors' => [ '{{WRAPPER}} .type-post:hover .entry-content' => 'background-color: var(--theme-color{{VALUE}});' ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); //Category Filter $this->start_controls_section( 'cat_filter_section', [ 'label' => esc_html__( 'Category Filter', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); mascot_core_realexa_get_cat_filter_arraylist( $this, 1, array('display_type' => array('grid', 'masonry', 'masonry-tiles', 'carousel') ) ); mascot_core_realexa_get_cat_filter_arraylist( $this, 2 ); mascot_core_realexa_get_cat_filter_arraylist( $this, 3 ); mascot_core_realexa_get_cat_filter_arraylist( $this, 4 ); $this->end_controls_section(); $this->start_controls_section( 'button_options', [ 'label' => esc_html__( 'Button Options', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); mascot_core_realexa_get_viewdetails_button_arraylist($this, 1); mascot_core_realexa_get_viewdetails_button_arraylist($this, 2); mascot_core_realexa_get_button_arraylist($this, 1); $this->add_control( 'read_more_button_icon_type', [ 'label' => esc_html__( 'Read More Button Icon Type', 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => [ 'no-icon' => esc_html__( 'No Icon', 'mascot-core-realexa' ), 'font-icon' => esc_html__( 'Font Icon', 'mascot-core-realexa' ), 'image' => esc_html__( 'Image Icon', 'mascot-core-realexa' ), ], 'default' => 'image', 'separator' => 'before', ] ); $this->add_control( 'read_more_button_icon', [ 'label' => esc_html__( 'Read More Button Icon', 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'default' => [ 'value' => 'fas fa-arrow-right', 'library' => 'fa-solid', ], 'recommended' => [ 'fa-solid' => [ 'arrow-right', 'arrow-right-long', 'chevron-right', 'angle-right', 'angle-double-right', 'caret-right', ], 'fa-regular' => [ 'caret-square-right', ], ], 'label_block' => false, 'skin' => 'inline', 'condition' => [ 'read_more_button_icon_type' => 'font-icon', ], ] ); $this->add_control( 'read_more_button_icon_image', [ 'label' => esc_html__( 'Read More Button Icon Image', 'mascot-core-realexa' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'description' => esc_html__( 'Upload an icon image for the read more button. If not provided, a default icon will be used.', 'mascot-core-realexa' ), 'condition' => [ 'read_more_button_icon_type' => 'image', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'button_color_typo_options', [ 'label' => esc_html__( 'Button Color/Typography', 'mascot-core-realexa' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); mascot_core_realexa_get_button_text_color_typo_arraylist($this, 1); $this->end_controls_section(); } public function query_posts() { $settings = $this->get_settings_for_display(); $paged = isset($settings['paged']) ? $settings['paged'] : ''; //if single post selected if( $settings['show_only_selected_single_post'] == 'yes' && !empty( $settings['selected_single_post'] )) { //query args $args = array( 'p' => $settings['selected_single_post'], ); } else { //query args $args = array( 'orderby' => $settings['order_by'], 'order' => $settings['order'], 'posts_per_page' => $settings['total_items'], 'paged' => $paged, ); if( ! empty( $settings['ids'] ) ) { $args['post__in'] = $settings['ids']; } if( ! empty( $settings['category'] ) ) { $args['tax_query'] = array( array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => $settings['category'], ), ); } } return $the_query = new \WP_Query( $args ); } /** * Render the widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $class_instance = ''; if(isset($settings['post_meta_options']) && !empty($settings['post_meta_options'])) { $settings['post_meta_options'] = implode(",", $settings['post_meta_options']); } $settings['holder_id'] = realexa_get_isotope_holder_ID('blog'); $this->render_output( $class_instance, $settings ); } public function render_output( $class_instance, $settings ) { $settings['the_query'] = $this->query_posts(); //button classes $settings['btn_classes'] = mascot_core_realexa_prepare_button_classes_from_params( $settings ); //classes $classes = array(); $settings['classes'] = $classes; $settings['settings'] = $settings; //Produce HTML version by using the parameters (filename, variation, folder name, parameters, shortcode_ob_start) $html = mascot_core_realexa_get_cpt_shortcode_template_part( 'blog', $settings['display_type'], 'blog/tpl/type', $settings, true ); echo $html; } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
skins
---
0755
tpl
---
0755
widget.php
34624 bytes
0644
N4ST4R_ID | Naxtarrr