Creating an Elementor Plugin: I’ve copied the PHP example code, but how do I enable it?


I’m not very experienced with PHP, so please bear me. I’ve copied and pasted the example code from the official documentation into my plugin subfolder and – as I expected – the example is not complete. the piece of code is not executed. As far as I know in fact, PHP is not executing a class if I don’t call it explicitly.

I could simply instantiate an object of my widget class, but is that the correct way? Which is the standard way to execute the PHP code that loads an Elementor Widget?

I see there is a module.php file in each widget subfolder containting some code like this:

namespace ElementorProModulesNavMenu;

use ElementorProBaseModule_Base;

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

class Module extends Module_Base {

    public function get_widgets() {
        return [

    public function get_name() {
        return 'nav-menu';
Revious 3 months 0 Answers 4 views 0

Leave an answer