D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
realadss
/
thathagroup.com
/
wp-content
/
themes
/
prooty
/
elementor
/
widgets
/
Filename :
search.php
back
Copy
<?php use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Utils; use Elementor\Group_Control_Border; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Prooty_Elementor_Search extends Widget_Base { public function get_name() { return 'prooty_elementor_search'; } public function get_title() { return esc_html__( 'Search', 'prooty' ); } public function get_icon() { return 'eicon-search'; } public function get_categories() { return [ 'prooty' ]; } public function get_script_depends() { return [ '' ]; } // Add Your Controll In This Function protected function register_controls() { $this->start_controls_section( 'search_section', [ 'label' => esc_html__( 'Search', 'prooty' ), ] ); $this->add_control( 'search_icon', [ 'label' => esc_html__( 'Icon', 'prooty' ), 'type' => \Elementor\Controls_Manager::ICONS, 'default' => [ 'value' => 'flaticon flaticon-magnifying-glass', 'library' => 'flaticon', ], ] ); $this->add_control( 'placeholder', [ 'label' => esc_html__( 'Placeholder', 'prooty' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__( 'Search here', 'prooty' ), 'placeholder' => esc_html__( 'Search here', 'prooty' ), ] ); $this->end_controls_section(); // Style tab $this->start_controls_section( 'form_section_style', [ 'label' => esc_html__( 'Form', 'prooty' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'form_width', [ 'label' => esc_html__( 'Width', 'prooty' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 300, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-search .form-search' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'input_typography', 'selector' => '{{WRAPPER}} .ova-search form input', ] ); $this->add_control( 'form_text_color', [ 'label' => esc_html__( 'Color', 'prooty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-search form input' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'form_background', 'types' => [ 'classic', 'gradient'], 'selector' => '{{WRAPPER}} .ova-search form input', ] ); $this->add_control( 'padding_form', [ 'label' => esc_html__( 'Padding', 'prooty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'custom' ], 'selectors' => [ '{{WRAPPER}} .ova-search form input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'margin_form', [ 'label' => esc_html__( 'Margin', 'prooty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'custom' ], 'selectors' => [ '{{WRAPPER}} .ova-search form' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_shadow_form', 'selector' => '{{WRAPPER}} .ova-search form input', ] ); $this->end_controls_section(); $this->start_controls_section( 'icon_section', [ 'label' => esc_html__( 'Icon', 'prooty' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'icon_size', [ 'label' => esc_html__( 'Size', 'prooty' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-search .search-form .search-button i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'icon_color', [ 'label' => esc_html__( 'Color', 'prooty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-search .search-form .search-button i' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'icon_color_hover', [ 'label' => esc_html__( 'Hover Color', 'prooty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-search .search-form .search-button:hover i' => 'color: {{VALUE}}', ], ] ); $this->end_controls_section(); } // Render Template Here protected function render() { $settings = $this->get_settings(); $placeholder = $settings['placeholder']; $search_icon = $settings['search_icon']; ?> <div class="ova-search"> <form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>"> <input type="search" class="search-field" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo get_search_query();?>" name="s" title="<?php esc_attr_e( 'Search for:', 'prooty' ) ?>" /> <button type="submit" class="search-button"> <?php \Elementor\Icons_Manager::render_icon( $search_icon, [ 'aria-hidden' => 'true' ] ); ?> </button> </form> </div> <?php } } $widgets_manager->register( new Prooty_Elementor_Search() );