|
/ Documentation /Developer Docs/ How to Create Custom Extensions and Add Custom Options in SureDash

How to Create Custom Extensions and Add Custom Options in SureDash

This guide walks you through the process of building a custom SureDash extension and integrating your own options into the SureDash Settings and Meta Sidebar.

1. Overview

SureDash provides hooks and filters that make it easy to extend its functionality without modifying the core plugin. By creating a custom extension, you can add new settings, enhance the dashboard, and control space-level metadata.

2. Prerequisites

Before you start, make sure you have:

  • A basic understanding of WordPress plugin development.
  • Access to the SureDash plugin is installed and activated.
  • The sample addon plugin provided here: Download Addon Plugin 
  • Demo walkthrough video: Watch Here

3. Creating a Custom SureDash Extension

  1. Download and Extract the Addon
    Use the addon plugin zip file as a starting point.
  2. Install and Activate the Plugin
    • Go to Plugins > Add New.
    • Upload the suredash-addon.zip.
    • Click Activate once installed.

Understand the Plugin Structure
The main plugin file is: suredash-addon.php

  1.  This is where you’ll register hooks and filters to add your custom functionality.

4. Adding Custom Options in SureDash Settings

SureDash exposes the filter suredashboard_settings_dataset to manage custom settings.
This filter allows you to define default values, data types, and custom fields.

Example Code

add_filter( 'suredashboard_settings_dataset', function( $settings ) {

    // Add a new custom setting
    $settings['my_custom_option'] = array(
        'type'    => 'string',       // Data type
        'default' => '',             // Default value
        'label'   => __( 'My Custom Option', 'suredash-addon' ),
    );

    return $settings;
});

Explanation

  • type: Defines the data type (e.g., string, boolean, integer).
  • default: Sets the initial value.
  • label: The title that appears in the settings UI.

5. Adding Custom Options in the Meta Sidebar

For space-level metadata, SureDash provides the suredashboard_post_meta_dataset filter.
This lets you add custom options to the Meta Sidebar within spaces.

Example Code

add_filter( 'suredashboard_post_meta_dataset', function( $meta ) {

    // Add a new meta field at the space level
    $meta['custom_meta_field'] = array(
        'type'    => 'boolean',
        'default' => false,
        'label'   => __( 'Enable Custom Meta Option', 'suredash-addon' ),
    );

    return $meta;
});

Explanation

  • custom_meta_field: Unique key for your meta option.
  • type: Supported types include string, boolean, integer, etc.
  • default: The initial state of the option.
  • label: The name that will appear in the sidebar.

6. Reviewing Your Plugin

Once your custom extension is ready:

  1. Install and Activate: Make sure your addon is installed and active.
  2. Follow the Development Workflow: Check the EXTENSIBILITY_GUIDE.md file in the SureDash plugin for detailed steps.
  3. Watch the Demo Video: Go through the demo video to see the development process in action.

7. Resources

8. Summary

With SureDash’s extensibility hooks, you can:

  • Create custom extensions without touching core files.
  • Add custom options in the Settings Panel.
  • Extend the Meta Sidebar at the space level.
  • Follow the provided demo and guide for a smooth development experience.
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

On this page
Scroll to Top