File: /home/tvypkwena2lu/public_html/wp-content/plugins/widgets/ele-theme-buttons.php
<?php
/**
* Elementor oEmbed Widget.
*
* Elementor widget that inserts an embbedable content into the page, from any given URL.
*
* @since 1.0.0
*/
class Elementor_ThemeButtons_Widget extends \Elementor\Widget_Base {
public function get_name() {
return 'theme_buttons';
}
public function get_title() {
return __( 'Theme Action Button', 'plugin-name' );
}
public function get_icon() {
return 'eicon-post-slider';
}
public function get_categories() {
return [ 'theme-specific-category' ];
}
protected function _register_controls() {
//apply_filters( 'elementor/utils/get_placeholder_image_src', get_template_directory_uri().'/images/banner-1.png' );
$this->start_controls_section(
'content_section',
[
'label' => __( 'Content', 'plugin-name' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title',
[
'label' => __( 'Title', 'plugin-name' ),
'type' => \Elementor\Controls_Manager::TEXT,
'input_type' => 'text',
'default' => __( 'Read More', 'plugin-name' ),
]
);
$this->add_control(
'website_link',
[
'label' => __( 'Read More URL', 'plugin-domain' ),
'type' => \Elementor\Controls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'plugin-domain' ),
'show_external' => true,
'default' => [
'url' => '',
'is_external' => false,
'nofollow' => false,
],
]
);
$this->add_control(
'testimonial_style',
[
'label' => __( 'Button Style', 'plugin-domain' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'style1',
'options' => [
'style1' => __( 'Style1', 'plugin-domain' ),
'style2' => __( 'Style2', 'plugin-domain' ),
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
//$settings['testimonial_style']
$style='';
//echo '<pre>';
//var_dump($settings['per_row']);
//echo '</pre>';
$settings = $this->get_settings_for_display();
$target = $settings['website_link']['is_external'] ? ' target="_blank"' : '';
$nofollow = $settings['website_link']['nofollow'] ? ' rel="nofollow"' : '';
if($settings['testimonial_style']==='style1') {
echo '
<p><a class="btn btn-secondary" href="'.$settings['website_link']['url']. '"' . $target . $nofollow . '>'.($settings['title'] ? $settings['title'] : 'Read More').'</a></p>
';
}
if($settings['testimonial_style']==='style2') {
echo '
<p><a class="btn btn-primary" href="'.$settings['website_link']['url']. '"' . $target . $nofollow . '>'.($settings['title'] ? $settings['title'] : 'Read More').' <i class="fas fa-long-arrow-alt-right ml-1"></i></a></p>
';
}
//} else {
//
//}
//wp_reset_postdata();
}
}