Skip to content
Guides

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 Template

Download 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:

PlaceholderDescriptionExample
NAMESPACESingle-word identifier used in class names to prevent conflictsmy
CONTROL-NAMEHyphen-separated identifier for your controlicon-picker
CONTROL_NAMEUnderscore-separated identifier for your controlicon_picker
CONTROL_LABELHuman-readable name for your controlIcon Picker
TEXTDOMAINTranslation identifier (recommended: use your plugin slug)lzb-icon-picker
PLUGIN_URLURL to your plugin's repository
PLUGIN_TAGSSEO-friendly tags for wordpress.org
SHORT_DESCRIPTIONConcise control description (max 2 lines)
EXTENDED_DESCRIPTIONDetailed control description
AUTHOR_NAMEYour name or wordpress.org username
AUTHOR_URLYour website URL

Implementation Steps

  1. Download the template repository
  2. Replace all placeholders with your custom values
  3. Copy the modified plugin to your WordPress plugins directory (wp-content/plugins)
  4. 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.

Was this article helpful?