-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
347757c
commit 4157483
Showing
7 changed files
with
117 additions
and
6 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Widget Information | ||
|
||
<Badge type="tip" vertical="top" text="Elementor Core" /> <Badge type="warning" vertical="top" text="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). | ||
|
||
```php | ||
class Elementor_Test_Widget extends \Elementor\Widget_Base { | ||
|
||
public function get_name() { | ||
return 'widget_name'; | ||
} | ||
|
||
} | ||
``` | ||
|
||
## 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. | ||
|
||
```php | ||
class Elementor_Test_Widget extends \Elementor\Widget_Base { | ||
|
||
public function get_title() { | ||
return esc_html__( 'My Widget Name', 'textdomain' ); | ||
} | ||
|
||
} | ||
``` | ||
|
||
## 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](https://elementor.github.io/elementor-icons/) or [FontAwesome icons](https://fontawesome.com/), returning the icon CSS class. Custom icons can also be used. | ||
|
||
```php | ||
class Elementor_Test_Widget extends \Elementor\Widget_Base { | ||
|
||
public function get_icon() { | ||
return 'eicon-code'; | ||
} | ||
|
||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Widget Promotions | ||
|
||
<Badge type="tip" vertical="top" text="Elementor Core" /> <Badge type="warning" vertical="top" text="Intermediate" /> | ||
|
||
<img :src="$withBase('/assets/img/elementor-widget-promotion.png')" alt="Elementor Widget Promotion" style="float: right; width: 300px; margin-left: 20px; margin-bottom: 20px;"> | ||
|
||
Elementor widgets have two builtin location in the widget panel for promotions and upsells. | ||
|
||
The first option is a simple "Need Help?" url which is an external link with general information about the widget. | ||
|
||
The second option is a call-to-action area with offers to upgrade to premium widgets/products/services. | ||
|
||
## Widget Help URL | ||
|
||
Help links displayed at the bottom of the widget panel bellow all the sections. This is a builtin feature providing the user consistent user experience across all Elementor widgets. | ||
|
||
Each widget have the option to set an external link containing general information about that specific widget and instruction how to use it. | ||
|
||
```php | ||
class Elementor_Test_Widget extends \Elementor\Widget_Base { | ||
|
||
public function get_custom_help_url() { | ||
return 'https://example.com/widget-name'; | ||
} | ||
|
||
} | ||
``` | ||
|
||
## Widget Promotion | ||
|
||
Promotions are a way for freemium plugins to offer upsells to upgrade to premium widgets/products/services. Widget promotions displayed at the bottom of the widget panel. | ||
|
||
```php | ||
class Elementor_Test_Widget extends \Elementor\Widget_Base { | ||
|
||
protected function get_upsale_data() { | ||
return [ | ||
'condition' => ! \Elementor\Utils::has_pro(), | ||
'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ), | ||
'image_alt' => esc_attr__( 'Upgrade', 'textdomain' ), | ||
'title' => esc_html__( 'Promotion heading', 'textdomain' ), | ||
'description' => esc_html__( 'Get the premium version of the widget and grow your website capabilities.', 'textdomain' ), | ||
'upgrade_url' => esc_url( 'https://example.com/upgrade-to-pro/' ), | ||
'upgrade_text' => esc_html__( 'Upgrade Now', 'textdomain' ), | ||
]; | ||
} | ||
|
||
} | ||
``` | ||
|
||
This is the place to emphasize that the promotion is set on a specific widget. It allows addon developers to create a custom CTA to promote a premium version of that widget. | ||
|
||
There is an option to conditionally hide/display this promotion if some conditions are met. For example, Elementor uses widget promotions only when Elementor Pro is not active, therefore paying customers don't see widget promotions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters