Create a production-ready single-file WordPress plugin that adds a custom Elementor widget named "Hello World".
Requirements:
- Must only load if Elementor is active; show an admin notice if Elementor is missing.
- Register the widget via Elementor hooks compatible with Elementor v3+.
- Widget details:
- Name/slug: p0_hello_world
- Title: "Hello World"
- Icon: any appropriate Elementor icon (e.g., eicon-editor-code)
- Categories: add to a custom category "Plugin0"; if category registration is needed, register it.
- Keywords: hello, world, plugin0
- Widget controls:
- Content section:
- Text control: "Heading" (default "Hello World")
- Textarea control: "Description" (default "This is a custom Elementor widget.")
- Style section:
- Color control for heading color
- Typography group control for heading
- Color control for description color
- Typography group control for description
- Alignment responsive control applying to wrapper
- Spacing controls: margin and padding for wrapper
- Frontend output:
- Render a wrapper div with class p0-hello-world
- Output heading in an h2 with class p0-hello-world__heading and description in a div with class p0-hello-world__description.
- Sanitize/escape properly for frontend.
- Editor preview:
- Implement content_template() for live preview in Elementor editor using Backbone templates.
- Assets:
- Add minimal CSS, ideally inline via wp_register_style with empty src then wp_add_inline_style, and enqueue only when widget is used if possible; otherwise enqueue on Elementor frontend/editor.
- CSS should style the wrapper with a subtle border and padding by default.
- Code quality:
- Use namespaces or class prefixes to avoid collisions.
- Follow WP coding standards, use hooks init, plugins_loaded, etc.
- Keep everything in one PHP file.
Also include optional p0_debug logs at key points (e.g., when Elementor missing, when widget registered) without being noisy.