# Widget Information

Elementor Core Intermediate

Elementor widget need to have a unique ID used in the code, and an addition basic information used in the Elementor editor.

# Widget Name/ID

To set a unique ID for the widget, use the get_name() method. This string is used in code and in the database. The name should include only lowercase letters and it should not contain spaces (use _ instead).

class Elementor_Test_Widget extends \Elementor\Widget_Base {

	public function get_name() {
		return 'widget_name';
	}

}
1
2
3
4
5
6
7

# Widget Title

Widget title is the label used in the Elementor editor. The end user will see this text when interacting with different panels. The title should use internalization functions to make the string translatable to other languages.

class Elementor_Test_Widget extends \Elementor\Widget_Base {

	public function get_title() {
		return esc_html__( 'My Widget Name', 'textdomain' );
	}

}
1
2
3
4
5
6
7

# Widget Icon

Each widget has not only a label but also an icon. This icons is displayed in different location in the Editor, like the elements panel and the navigator panel. It's not a required field, but very recommended.

Widgets can use any Elementor icons (opens new window) or FontAwesome icons (opens new window), returning the icon CSS class. Custom icons can also be used.

class Elementor_Test_Widget extends \Elementor\Widget_Base {

	public function get_icon() {
		return 'eicon-code';
	}

}
1
2
3
4
5
6
7