Create Custom Control
While Lazy Blocks plugin comes with a comprehensive set of built-in controls like text, gallery, and repeater, you might need to create custom controls for specific project requirements. This guide will help you implement your own custom controls.
Getting Started with Custom Controls
We've created a template plugin to help you quickly start developing custom controls. This template includes a basic text control with custom styling and attributes, serving as an excellent foundation for your custom control development:
Download Custom Control TemplateDownload and review all files in the template repository, including comments and documentation, to understand the implementation details.
Customizing the Template
The template contains placeholders that you'll need to replace with your specific implementation details. Here's a reference table of available placeholders:
Placeholder | Description | Example |
---|---|---|
NAMESPACE | Single-word identifier used in class names to prevent conflicts | my |
CONTROL-NAME | Hyphen-separated identifier for your control | icon-picker |
CONTROL_NAME | Underscore-separated identifier for your control | icon_picker |
CONTROL_LABEL | Human-readable name for your control | Icon Picker |
TEXTDOMAIN | Translation identifier (recommended: use your plugin slug) | lzb-icon-picker |
PLUGIN_URL | URL to your plugin's repository | |
PLUGIN_TAGS | SEO-friendly tags for wordpress.org | |
SHORT_DESCRIPTION | Concise control description (max 2 lines) | |
EXTENDED_DESCRIPTION | Detailed control description | |
AUTHOR_NAME | Your name or wordpress.org username | |
AUTHOR_URL | Your website URL |
Implementation Steps
- Download the template repository
- Replace all placeholders with your custom values
- Copy the modified plugin to your WordPress plugins directory (
wp-content/plugins
) - Activate the plugin through WordPress admin panel
Ensure all placeholders are replaced before activating the plugin to avoid conflicts with other WordPress plugins.
The resulting plugin will contain all necessary components for your custom control implementation, ready for further customization according to your specific needs.