Giter Site home page Giter Site logo

How to add a new widget? about elementor HOT 9 CLOSED

elementor avatar elementor commented on May 20, 2024
How to add a new widget?

from elementor.

Comments (9)

jonathanbossenger avatar jonathanbossenger commented on May 20, 2024 4

@KingYes I hope you don't mind me commenting on this, but it would be helpful to get this added to the newly created developer portal - https://developers.elementor.com/creating-a-new-widget/

I've used

\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Class_Name_Widget() );

in case any stumbles across this.

from elementor.

shangdev avatar shangdev commented on May 20, 2024 1

@jonathanbossenger Hello,when I created customize new widget,There are some Widget Controls not working, E.g: SLIDER/COLOR/SWITCHER,

Have you encountered this problem?

from elementor.

yehudah avatar yehudah commented on May 20, 2024

Hi,

We still don't have official API, but you can write a regular WordPress widget and he will be available in builder widgets.

from elementor.

KingYes avatar KingYes commented on May 20, 2024

@nicolas92 Fast example:

add_action( 'elementor/widgets/widgets_registered', function() {
    \Elementor\Plugin::instance()->widgets_manager->register_widget( 'WIDGET_CLASS' );
} );

Change the WIDGET_CLASS to your own class of the widget.

BTW, as @yehudah say, it's not official API to register widgets, so maybe it's can to change in later versions of the Elementor. But for now it's need to be work for you.

from elementor.

nicolas92 avatar nicolas92 commented on May 20, 2024

Ah thin, I thought it was possible, prévoyer you do it in long time?
I think your plugin will cartoning, so many dévelloppeur will want to integrate their own widgets like visual composer.

from elementor.

nicolas92 avatar nicolas92 commented on May 20, 2024

Thank you very much @KingYes, but it is not urgent, I'll wait for the official API, thank you :)

from elementor.

KingYes avatar KingYes commented on May 20, 2024

No problem :)
Thanks for your review and 5-stars 👍

from elementor.

nicolas92 avatar nicolas92 commented on May 20, 2024

You deserved, amazing plugin :)

from elementor.

vollyimnetz avatar vollyimnetz commented on May 20, 2024

I used the following code inside my functions.php to add an elementor-widget.

add_action( 'elementor/widgets/widgets_registered', function($elementorWidgetManager) {
	include_once __DIR__.'/path-to-my-widget-file.php';
	$elementorWidgetManager->register_widget_type( new MyCustomElementorWidget() );
});

By making the include of the code inside the action-hook, i can make sure elementor is installed, active and already loaded.

I support the request of @jonathanbossenger, it belongs something in the documentation how a new elementor widget can be registered correctly.

from elementor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.