Skip to main content

UI Customization

While MCP for WP is designed to be user-friendly out of the box, we understand that you may want to tailor the user interface to better fit your needs or brand. This guide provides an overview of the customization options available.

🧰 Customizing with Hooks and Filters

For developers, the most powerful way to customize the UI is by using WordPress hooks (actions and filters). MCP for WP provides a variety of hooks that allow you to modify almost every aspect of the admin interface.

Adding Custom Fields to the Tool Editor

You can add your own custom fields to the tool editor screen. This is useful if you need to collect additional information for your custom tools.

php
// Example: Add a custom text field to the tool editor
add_action( 'wpmcp_tool_editor_fields', 'my_custom_tool_field' );

function my_custom_tool_field( $post ) {
    $value = get_post_meta( $post->ID, '_my_custom_field', true );
    ?>
    <div class="form-field">
        <label for="my_custom_field">My Custom Field</label>
        <input type="text" id="my_custom_field" name="my_custom_field" value="<?php echo esc_attr( $value ); ?>">
    </div>
    <?php
}

Modifying the Dashboard Columns

You can also add, remove, or modify the columns displayed on the main tool dashboard.

php
// Example: Add a new column to the tool dashboard
add_filter( 'wpmcp_tool_dashboard_columns', 'my_custom_dashboard_column' );

function my_custom_dashboard_column( $columns ) {
    $columns['my_column'] = 'My Custom Column';
    return $columns;
}

For a full list of available hooks and filters, please refer to the Developer Reference.

🎨 Customizing the Look and Feel with CSS

If you simply want to change the visual appearance of the admin interface, you can enqueue your own custom stylesheet to override the default styles.

php
// Example: Enqueue a custom stylesheet for the MCP for WP admin screens
add_action( 'admin_enqueue_scripts', 'my_wpmcp_admin_styles' );

function my_wpmcp_admin_styles( $hook ) {
    // Ensure we are on a MCP for WP admin screen
    if ( strpos( $hook, 'wpmcp' ) === false ) {
        return;
    }

    wp_enqueue_style(
        'my-wpmcp-styles',
        get_stylesheet_directory_uri() . '/css/my-wpmcp-styles.css'
    );
}

By adding your own CSS, you can change colors, fonts, spacing, and more to match your brand or personal preferences.

🚀 Future Customization Options

We are always looking for ways to make MCP for WP more flexible. In the future, we plan to add more built-in UI customization options directly into the plugin's settings page, allowing you to make changes without writing any code. Stay tuned for updates!