Skip to content

Instantly share code, notes, and snippets.

@paperbonsai
paperbonsai / elementor_custom_shortcode.php
Created June 25, 2023 20:24
This code defines a custom widget for the Elementor page builder plugin in WordPress, which extends Elementor's existing Shortcode widget. The purpose of this custom widget is to provide a more convenient way for users to insert predefined shortcodes while editing their pages with Elementor.
add_action('elementor/elements/elements_registered', function () {
if (!\Elementor\Plugin::$instance->editor->is_edit_mode()) {
return;
}
class Extended_Shortcode_Widget extends \Elementor\Widget_Shortcode
{
public function get_name()
{
return 'shortcode';