Sindbad~EG File Manager
<?php
namespace deedsPLUGIN\Element;
use Elementor\Controls_Manager;
use Elementor\Controls_Stack;
use Elementor\Group_Control_Typography;
use Elementor\Core\Schemes\Typography;
use Elementor\Core\Schemes\Color;
use Elementor\Group_Control_Border;
use Elementor\Repeater;
/**
* Elementor button widget.
* Elementor widget that displays a button with the ability to control every
* aspect of the button design.
*
* @since 1.0.0
*/
class Carousel extends \Elementor\Widget_Base {
/**
* Get widget name.
* Retrieve button widget name.
*
* @since 1.0.0
* @access public
* @return string Widget name.
*/
public function get_name() {
return 'deeds_carousel';
}
/**
* Get widget title.
* Retrieve button widget title.
*
* @since 1.0.0
* @access public
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Carousel', 'deeds' );
}
/**
* Get widget icon.
* Retrieve button widget icon.
*
* @since 1.0.0
* @access public
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-media-carousel';
}
/**
* Get widget categories.
* Retrieve the list of categories the button widget belongs to.
* Used to determine where to display the widget in the editor.
*
* @since 2.0.0
* @access public
* @return array Widget categories.
*/
public function get_categories() {
return [ 'webinane' ];
}
/**
* Register button 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() {
$elem_lib = wp_list_pluck( get_posts( array(
'post_type' => 'elementor_library',
'posts_per_page' => 100,
) ), 'post_title', 'ID' );
$thm_lib = wp_list_pluck( get_post_types( [ 'publicly_queryable' => true ], 'object' ), 'label', 'name' );
$this->start_controls_section(
'query',
[
'label' => esc_html__( 'Query', 'deeds' ),
]
);
$this->add_control(
'template',
[
'label' => esc_html__( 'Elementor Template', 'deeds' ),
'type' => Controls_Manager::SELECT2,
'options' => $elem_lib,
]
);
$this->add_control(
'post_type',
[
'label' => esc_html__( 'Post Type', 'deeds' ),
'type' => Controls_Manager::SELECT2,
'options' => $thm_lib,
]
);
$this->add_control(
'query_exclude',
[
'label' => esc_html__( 'Exclude', 'deeds' ),
'type' => Controls_Manager::TEXT,
'description' => esc_html__( 'Exclude posts, pages, etc. by ID with comma separated.', 'deeds' ),
]
);
$this->add_control(
'query_number',
[
'label' => esc_html__( 'Number', 'deeds' ),
'type' => Controls_Manager::NUMBER,
'default' => 3,
'min' => 1,
'max' => 100,
'step' => 1,
]
);
$this->add_control(
'query_orderby',
[
'label' => esc_html__( 'Order By', 'deeds' ),
'type' => Controls_Manager::SELECT,
'default' => 'date',
'options' => array(
'date' => esc_html__( 'Date', 'deeds' ),
'title' => esc_html__( 'Title', 'deeds' ),
'menu_order' => esc_html__( 'Menu Order', 'deeds' ),
'rand' => esc_html__( 'Random', 'deeds' ),
),
]
);
$this->add_control(
'query_order',
[
'label' => esc_html__( 'Order', 'deeds' ),
'type' => Controls_Manager::SELECT,
'default' => 'DESC',
'options' => array(
'DESc' => esc_html__( 'DESC', 'deeds' ),
'ASC' => esc_html__( 'ASC', 'deeds' ),
),
]
);
$this->end_controls_section();
}
public function get_script_depends() {
return [
'deeds-owl-carousel',
];
}
/**
* Render button 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();
$this->add_render_attribute( 'wrapper', 'class', ['webinane-deeds', 'testimonials-car', 'owl-carousel'] );
$args = array(
'post_type' => deeds_set( $settings, 'post_type' ),
'posts_per_page' => deeds_set( $settings, 'query_number' ),
'orderby' => deeds_set( $settings, 'query_orderby' ),
'order' => deeds_set( $settings, 'query_order' ),
);
if ( deeds_set( $settings, 'query_exclude' ) ) {
$settings['query_exclude'] = explode( ',', $settings['query_exclude'] );
$args['post__not_in'] = deeds_set( $settings, 'query_exclude' );
}
$query = new \WP_Query( $args );
if ( $query->have_posts() ) { ?>
<div <?php echo $this->get_render_attribute_string( 'wrapper' ) ?>>
<?php while($query->have_posts()) : $query->the_post();
$file = get_theme_file_path( "elementor/elementor/carousel.php" );
if ( file_exists( $file ) ) {
include $file;
} else {
?>
<?php
$template_id = $settings['template'];
if ( $template_id ) {
echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $template_id );
}
?>
<?php
}
endwhile; ?>
</div>
<?php }
wp_reset_postdata();
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists