Prerequisites
Before creating a module, ensure you have:- A WordPress site with Beaver Builder installed
- A custom plugin or child theme for your code
- Basic knowledge of PHP, HTML, and CSS
- Access to your site’s file system
Module Creation Workflow
Create Module Directory
Create a folder for your module in your plugin or theme:The folder name should be lowercase with hyphens and will become your module’s slug.
Create Main Module File
Create
my-module.php in your module directory:my-module/my-module.php
The class name should be unique and follow WordPress naming conventions. Use PascalCase with a descriptive suffix like
Module or Class.Register Module Settings
Add the module registration and settings form at the end of your main file:
my-module/my-module.php
Create Frontend Template
Create
includes/frontend.php to render your module:my-module/includes/frontend.php
Create CSS Template
Create
includes/frontend.css.php for dynamic styles:my-module/includes/frontend.css.php
Register Your Module
In your plugin’s main file, register the module with Beaver Builder:
my-plugin.php
Complete Example
Here’s a minimal working module:Module Registration
Load your module in your plugin’s main file:my-plugin.php
Common Issues
Module doesn't appear in builder
Module doesn't appear in builder
- Verify your plugin is activated
- Check that the module class extends
FLBuilderModule - Ensure
FLBuilder::register_module()is called - Clear WordPress and Beaver Builder caches
- Check for PHP errors in debug log
Settings not saving
Settings not saving
- Verify field names match what you’re accessing in templates
- Check that the settings array is properly structured
- Ensure default values are set for required fields
- Look for JavaScript errors in browser console
Styles not applying
Styles not applying
- Verify
frontend.css.phpis in theincludes/directory - Check that you’re using the correct
$idvariable for selectors - Clear browser cache and regenerate CSS
- Ensure CSS specificity is high enough
Next Steps
Module Structure
Learn about module file organization and required files
Frontend Rendering
Discover how to render module output and dynamic CSS
Settings Forms
Explore available field types and form configuration
Module API
Reference the complete module API documentation
Best Practices
- Use unique class names to avoid conflicts with other modules
- Sanitize and escape all output for security
- Provide sensible defaults for all settings
- Support responsive design with responsive field types
- Test thoroughly across different themes and page layouts
- Follow WordPress coding standards for consistency
- Document your code to help future maintainers
- Use translation functions for all user-facing text