Social Media Follow Buttons Widget

Home » Snippets » Social Media Follow Buttons Widget
0

Created with:

Elementor Widget Generator

Visibility: 

public

Creator: WPTurbo Team

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
				/**
 * Plugin Name: Social Media Follow Buttons Widget
 * Description: A custom Elementor widget generated by <a href='https://wpturbo.dev/generators/elementor-widget/'>WPTurbo's Elementor Widget Generator</a>.
 * Plugin URI:  https://wpturbo.dev/
 * Version:     1.0.0
 * Author:      WPTurbo Elementor Widget Generator
 * Author URI:  https://wpturbo.dev/generators/elementor-widget/
 * Text Domain: wpturbo
 */


if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Register oEmbed Widget.
 *
 * Include widget file and register widget class.
 *
 * @since 1.0.0
 * @param \Elementor\Widgets_Manager $widgets_manager Elementor widgets manager.
 * @return void
 */

function wpturbo_register_custom_elementor_plugin( \Elementor\Widgets_Manager $widgets_manager ) : void {
	$widgets_manager->register( new Custom_Elementor_Widget() );
}

add_action( 'elementor/widgets/register', 'wpturbo_register_custom_elementor_plugin' );
class Custom_Elementor_Widget extends \Elementor\Widget_Base {

	/**
	 * Get widget name.
	 *
	 * Retrieve oEmbed widget name.
	 *
	 * @since 1.0.0
	 * @access public
	 * @return string Widget name.
	 */
	public function get_name(): string {
		return 'wpturbo-social-media-follow-buttons';
	}


		/**
	 * Get widget title.
	 *
	 * Retrieve oEmbed widget title.
	 *
	 * @since 1.0.0
	 * @access public
	 * @return string Widget title.
	 */
	public function get_title(): string {
		return __( 'Social Media Follow Buttons Widget', 'wpturbo' );
	}


	/**
	 * Get widget icon.
	 *
	 * Retrieve oEmbed widget icon.
	 *
	 * @since 1.0.0
	 * @access public
	 * @return string Widget icon.
	 */
	public function get_icon(): string {
		return 'fa fa-star';
	}


	/**
	 * Get custom help URL.
	 *
	 * Retrieve a URL where the user can get more information about the widget.
	 *
	 * @since 1.0.0
	 * @access public
	 * @return string Widget help URL.
	 */
	public function get_custom_help_url(): string {
		// Replace this with your elementor widget's documentation URL.
		return 'https://wpturbo.dev/generators/elementor-widget/';
	}

	/**
	 * Get widget categories.
	 *
	 * Retrieve the list of categories the oEmbed widget belongs to.
	 *
	 * @since 1.0.0
	 * @access public
	 * @return array Widget categories.
	 */
	public function get_categories(): array {
		return array('general');
	}


	/**
	 * Register oEmbed widget controls.
	 *
	 * Add input fields to allow the user to customize the widget settings.
	 *
	 * @since 1.0.0
	 * @access protected
	 */
	protected function register_controls() : void {
		$this->start_controls_section( 'content_section', array(
			'label' => __( 'Social Media Follow Buttons', 'wpturbo' ),
			'tab' => ElementorControls_Manager::TAB_CONTENT,
		));

		$this->add_control( 'wpturbo-Instagram', array(
			'label' => __( 'Instagram', 'wpturbo' ),
			'type' => \Elementor\Controls_Manager::TEXT,
			'input_type' => 'url',
			'placeholder' => __( 'https://instagram.com', 'wpturbo' ),
		));

		$this->end_controls_section();
	}


	/**
	 * Render oEmbed widget output on the frontend.
	 *
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since 1.0.0
	 * @access protected
	 */
	protected function render() : void {
		$settings = $this->get_settings_for_display();
		echo '<div class="oembed-elementor-widget">';
			echo $settings['wpturbo-Instagram'];
		echo '</div>';
	}

}
			

Register an account to save your snippets or go Pro to get more features.