Skip to content

Quick Start

Three files. About fifteen lines of bootstrap.

  • Directorymy-plugin/
    • my-plugin.php (boot call)
    • Directoryconfig/
      • settings.php (field definitions)
    • Directoryvendor/
      • Directorywp-wireframe/ (the library)
        • …
  1. <?php
    /**
    * Plugin Name: My Plugin
    * Description: A plugin with settings powered by WP Wireframe.
    * Version: 1.0.0
    */
    if (! defined('ABSPATH')) {
    exit;
    }
    // Composer autoloader — use the manual path
    // (vendor/wp-wireframe/vendor/autoload.php) if you installed without Composer.
    require_once __DIR__ . '/vendor/autoload.php';
    add_action('init', function () {
    Wireframe\App::boot([
    'prefix' => 'my-plugin',
    'page_title' => __('My Plugin', 'my-plugin'),
    'option_key' => 'my_plugin_settings',
    'config' => __DIR__ . '/config/settings.php',
    ]);
    });
  2. <?php
    return [
    'tabs' => [
    [
    'id' => 'general',
    'title' => __('General', 'my-plugin'),
    'sections' => [
    [
    'id' => 'main',
    'title' => __('Main Settings', 'my-plugin'),
    'description' => __('Configure the basics.', 'my-plugin'),
    'fields' => [
    [
    'id' => 'site_name',
    'type' => 'text',
    'label' => __('Site Name', 'my-plugin'),
    'required' => true,
    'columns' => 6,
    'args' => ['placeholder' => __('My Website', 'my-plugin')],
    ],
    [
    'id' => 'contact_email',
    'type' => 'email',
    'label' => __('Contact Email', 'my-plugin'),
    'columns' => 6,
    ],
    [
    'id' => 'notifications',
    'type' => 'toggle',
    'label' => __('Enable Notifications', 'my-plugin'),
    'description' => __('Send alerts when settings change.', 'my-plugin'),
    'default' => true,
    ],
    ],
    ],
    ],
    ],
    ],
    ];
  3. Every Settings:: call takes your plugin’s option_key as the first argument, so multiple plugins sharing the framework can’t collide.

    use Wireframe\Settings;
    $name = Settings::get('my_plugin_settings', 'site_name', 'Default');
    $email = Settings::string('my_plugin_settings', 'contact_email');
    if (Settings::bool('my_plugin_settings', 'notifications')) {
    // send notification...
    }

    Activate your plugin and the settings page appears in the admin menu.

  • Configuration → all the boot options (overview), multi-page setups, submenu placement.
  • Field Types → the full reference for every field type the framework ships.
  • Features → conditional visibility, role-based access, validation.