Kavro Framework is a modern, lightweight, developer-first WordPress option framework for building polished admin panels, metaboxes, Customizer controls, taxonomy fields, user profile fields, nav menu item fields, widgets, comment fields, and shortcode generator interfaces.
Kavro is designed for theme and plugin developers who want a clean API, premium-looking UI, reusable field definitions, secure saving, and extensible Free/Pro architecture.
| Item | Details |
|---|---|
| Plugin Name | Kavro Framework |
| Version | 1.0.1 |
| Author | Md Abul Bashar |
| Author URI | https://hmbashar.com |
| https://facebook.com/hmbashar | |
| Plugin URI | https://github.com/hmbashar/kavro-framework |
| License | GPLv2 or later |
| Text Domain | kavro-framework |
| Website & Docs | https://hmbashar.github.io/kavro-framework |
Kavro provides framework APIs for the most common WordPress developer interfaces:
- Options Framework — premium admin option panels with nested sections and AJAX saving.
- Metabox Framework — post, page, and custom post type fields.
- Customizer Framework — WordPress Customizer panels, sections, and fields.
- Taxonomy Options — category, tag, and custom taxonomy term fields.
- Profile/User Options — fields on user profile screens with role targeting.
- Nav Menu Options — custom fields for individual menu items.
- Widget Options — widget configuration fields.
- Comment Options — fields on comment edit screens.
- Shortcode Framework — shortcode registration and admin generator UI.
- Free/Pro Architecture — module registration and gating for commercial extensions.
- Clean Codestar-style static API.
- Nested admin sections using
children. - Modern premium admin UI.
- Secure AJAX save/reset for options.
- Normal WordPress form fallback.
- Import/export/reset tools.
- Field-aware sanitization.
- Custom sanitizer callback support.
- Conditional field logic.
- Cloneable fields.
- Select2/enhanced select support.
- AJAX select support.
- Media, gallery, file, audio, and video upload fields.
- Date/time picker support.
- Performance-aware asset loading.
- PSR-4 compatible Composer structure.
- Translation-ready text domain.
- WordPress.org-ready demo loading control.
Upload the plugin folder to your WordPress installation:
wp-content/plugins/kavro-framework/
Then activate Kavro Framework from:
WordPress Admin → Plugins
For local development/testing, you may enable bundled examples by defining:
define( 'KAVRO_LOAD_EXAMPLES', true );Do not enable demo loading on production sites unless you intentionally want all demo screens and fields to appear.
if ( class_exists( 'KAVRO' ) ) {
/**
* Unique option prefix.
* This is used as the option name in the WordPress options table.
*/
$prefix = 'my_kavro_options';
/**
* Create the admin options panel.
*/
KAVRO::createOptions( $prefix, array(
'menu_title' => 'Theme Options',
'menu_slug' => 'theme-options',
) );
/**
* Create a basic section.
*/
KAVRO::createSection( $prefix, array(
'title' => 'General Settings',
'fields' => array(
array(
'id' => 'site_subtitle',
'type' => 'text',
'title' => 'Site Subtitle',
'desc' => 'Add a short subtitle for your website.',
'default' => 'Modern WordPress Framework',
),
array(
'id' => 'enable_preloader',
'type' => 'switcher',
'title' => 'Enable Preloader',
'default' => true,
),
),
) );
}Get saved option values:
$subtitle = kavro_get_option( 'my_kavro_options', 'site_subtitle', 'Default subtitle' );Kavro uses children for nested sections. You do not need a separate parent argument.
KAVRO::createSection( $prefix, array(
'title' => 'Design',
'icon' => 'dashicons-admin-customizer',
'children' => array(
array(
'title' => 'Colors',
'fields' => array(
array(
'id' => 'primary_color',
'type' => 'color',
'title' => 'Primary Color',
'default' => '#2563eb',
),
),
),
array(
'title' => 'Typography',
'children' => array(
array(
'title' => 'Body Font',
'fields' => array(
array(
'id' => 'body_typography',
'type' => 'typography',
'title' => 'Body Typography',
),
),
),
),
),
),
) );KAVRO::createOptions( $prefix, array(
'menu_title' => 'Theme Options',
'menu_slug' => 'theme-options',
) );
KAVRO::createSection( $prefix, array(
'title' => 'General',
'fields' => array(),
) );Documentation: docs/options.md
KAVRO::createMetabox( 'kavro_post_options', array(
'title' => 'Post Options',
'post_type' => array( 'post', 'page' ),
) );
KAVRO::createSection( 'kavro_post_options', array(
'title' => 'Layout',
'fields' => array(
array(
'id' => 'custom_layout',
'type' => 'select',
'title' => 'Custom Layout',
'options' => array(
'default' => 'Default',
'full' => 'Full Width',
),
),
),
) );Documentation: docs/metabox.md
KAVRO::createCustomizeOptions( 'kavro_customizer', array(
'title' => 'Kavro Customizer',
) );
KAVRO::createSection( 'kavro_customizer', array(
'title' => 'Branding',
'fields' => array(
array(
'id' => 'brand_color',
'type' => 'color',
'title' => 'Brand Color',
),
),
) );Documentation: docs/customizer.md
KAVRO::createTaxonomyOptions( 'kavro_category_options', array(
'taxonomy' => array( 'category', 'post_tag' ),
) );
KAVRO::createSection( 'kavro_category_options', array(
'title' => 'Term Design',
'fields' => array(
array(
'id' => 'term_color',
'type' => 'color',
'title' => 'Term Color',
),
),
) );Documentation: docs/taxonomy.md
KAVRO::createProfileOptions( 'kavro_profile_options', array(
'roles' => array( 'administrator', 'editor' ),
) );
KAVRO::createSection( 'kavro_profile_options', array(
'title' => 'Author Details',
'fields' => array(
array(
'id' => 'author_tagline',
'type' => 'text',
'title' => 'Author Tagline',
),
),
) );Documentation: docs/profile.md
KAVRO::createNavMenuOptions( 'kavro_menu_options', array(
'title' => 'Menu Item Options',
) );
KAVRO::createSection( 'kavro_menu_options', array(
'fields' => array(
array(
'id' => 'menu_badge',
'type' => 'text',
'title' => 'Menu Badge',
),
),
) );Documentation: docs/nav-menu.md
KAVRO::createWidgetOptions( 'kavro_widget_options', array(
'title' => 'Kavro Widget Options',
) );Documentation: docs/widget.md
KAVRO::createCommentOptions( 'kavro_comment_options', array(
'title' => 'Comment Options',
) );Documentation: docs/comment.md
KAVRO::createShortcode( 'kavro_button', array(
'title' => 'Kavro Button',
'fields' => array(
array(
'id' => 'label',
'type' => 'text',
'title' => 'Button Label',
),
array(
'id' => 'url',
'type' => 'url',
'title' => 'Button URL',
),
),
) );Documentation: docs/shortcode.md
The full field documentation is available in the docs/fields/ directory.
Start here:
Each dedicated field document includes:
- Purpose
- Value shape
- Common attributes
- Field-specific attributes
- Options example
- Metabox example
- Customizer example
- Taxonomy example
- Profile/User example
- Nav Menu example
- Widget example
- Comment example
- Shortcode example
- Saved value usage
- Developer notes
Most fields share a common array structure:
array(
'id' => 'example_field',
'type' => 'text',
'title' => 'Example Field',
'subtitle' => 'Optional short helper text.',
'desc' => 'Longer description shown below the field.',
'default' => 'Default value',
'dependency' => array( 'another_field', '==', 'enabled' ),
)See docs/shared-field-attributes.md for the complete shared attribute reference.
array(
'id' => 'enable_banner',
'type' => 'switcher',
'title' => 'Enable Banner',
'default' => false,
),
array(
'id' => 'banner_text',
'type' => 'text',
'title' => 'Banner Text',
'dependency' => array( 'enable_banner', '==', true ),
),Documentation: docs/validation.md
array(
'id' => 'custom_value',
'type' => 'text',
'title' => 'Custom Value',
'sanitize_callback' => function( $value, $field ) {
return sanitize_text_field( $value );
},
),Documentation: docs/validation.md
array(
'id' => 'social_profiles',
'type' => 'cloneable',
'title' => 'Social Profiles',
'fields' => array(
array(
'id' => 'label',
'type' => 'text',
'title' => 'Label',
),
array(
'id' => 'url',
'type' => 'url',
'title' => 'URL',
),
),
),Kavro includes helper functions for retrieving saved values from different contexts.
kavro_get_option( $option_name, $field_id, $default = null );
kavro_get_post_meta( $post_id, $field_id, $default = null );
kavro_get_term_meta( $term_id, $field_id, $default = null );
kavro_get_user_meta( $user_id, $field_id, $default = null );
kavro_get_comment_meta( $comment_id, $field_id, $default = null );
kavro_get_nav_menu_item_meta( $menu_item_id, $field_id, $default = null );
kavro_get_widget_option( $widget_id, $field_id, $default = null );docs/options.mddocs/metabox.mddocs/customizer.mddocs/taxonomy.mddocs/profile.mddocs/nav-menu.mddocs/widget.mddocs/comment.mddocs/shortcode.md
docs/security.mddocs/validation.mddocs/performance.mddocs/free-pro.mddocs/release-separation.mddocs/wordpress-org.mddocs/release-packaging.mddocs/stability-qa.mddocs/qa-report.md
Kavro includes Composer-compatible PSR-4 autoloading.
{
"autoload": {
"psr-4": {
"Kavro\\": "classes/"
}
}
}Run:
composer dump-autoloadKavro also includes its own internal loader so Composer is optional for normal plugin use.
Kavro detects field types and loads heavier assets only when needed.
Examples:
- Media scripts load for upload/media/gallery/image/file/audio/video fields.
- Color picker assets load for color-related fields.
- Sortable assets load for sortable/repeater/group/table-style fields.
- Select2/enhanced select assets load for enhanced content selectors.
- Date/time picker assets load for date, time, and datetime fields.
Documentation: docs/performance.md
Kavro includes:
- Capability checks.
- Nonce verification.
- Field-aware sanitization.
- Safer import validation.
- AJAX save/reset protection.
- Direct file access protection.
- Escaped output patterns.
Documentation: docs/security.md
Kavro includes a module registry so premium modules or add-ons can extend the free plugin cleanly.
KAVRO::registerModule( 'custom-module', array(
'title' => 'Custom Module',
'tier' => 'pro',
'class' => 'Vendor\\Plugin\\CustomModule',
) );Useful helpers:
kavro_is_pro();
kavro_edition();
kavro_get_modules();Documentation: docs/free-pro.md
Examples are disabled by default. The plugin is structured for WordPress.org-friendly distribution and includes:
readme.txtuninstall.php- GPL-compatible licensing notes
- No required remote CDN assets
- Translation-ready text domain
- Release packaging documentation
Documentation:
Bundled demo files live in the examples/ directory and are only loaded when:
define( 'KAVRO_LOAD_EXAMPLES', true );Example files include:
examples/basic-usage.phpexamples/options-demo.phpexamples/metabox-demo.phpexamples/customizer-demo.phpexamples/taxonomy-demo.phpexamples/profile-demo.phpexamples/nav-menu-demo.phpexamples/widget-demo.phpexamples/comment-demo.phpexamples/shortcode-demo.phpexamples/field-examples.phpexamples/pro-extension-demo.php
- Create your option/metabox/customizer/module prefix.
- Register the framework module with
KAVRO::create...(). - Add sections with
KAVRO::createSection(). - Add fields using documented field attributes.
- Retrieve saved values with Kavro helper functions.
- Add custom sanitizers for special values.
- Disable demo loading before production release.
Kavro Framework is licensed under the GPLv2 or later.
Copyright © Md Abul Bashar
Website: https://hmbashar.com
Facebook: https://facebook.com/hmbashar