Using WordPress ‘after_theme’ PHP action

The after_theme_row WordPress PHP action fires after each row in the Multisite themes list table.

Usage

add_action('after_theme_row', 'your_custom_function', 10, 3);

function your_custom_function($stylesheet, $theme, $status) {
    // your custom code here

}

Parameters

  • $stylesheet (string) – Directory name of the theme.
  • $theme (WP_Theme) – Current WP_Theme object.
  • $status (string) – Status of the theme.

More information

See WordPress Developer Resources: after_theme_row

Examples

Display a message after a specific theme row

This example displays a message after the row of a specific theme in the Multisite themes list table.

add_action('after_theme_row', 'display_message_after_theme_row', 10, 3);

function display_message_after_theme_row($stylesheet, $theme, $status) {
    if ('your-theme' === $stylesheet) {
        echo '**This is a custom message for Your Theme.**';
    }
}

This example adds a custom link after the row of a specific theme in the Multisite themes list table.

add_action('after_theme_row', 'add_link_after_theme_row', 10, 3);

function add_link_after_theme_row($stylesheet, $theme, $status) {
    if ('your-theme' === $stylesheet) {
        echo '**[Custom Link](https://example.com/custom-link)**';
    }
}

Display theme status after each row

This example displays the status of each theme after its row in the Multisite themes list table.

add_action('after_theme_row', 'display_theme_status_after_row', 10, 3);

function display_theme_status_after_row($stylesheet, $theme, $status) {
    echo '**Theme Status: ' . $status . '**';
}

Show a message for active themes

This example displays a message after the row of an active theme in the Multisite themes list table.

add_action('after_theme_row', 'display_message_for_active_themes', 10, 3);

function display_message_for_active_themes($stylesheet, $theme, $status) {
    if ('active' === $status) {
        echo '**This theme is currently active.**';
    }
}

Add custom data after theme row

This example adds custom data after the row of a specific theme in the Multisite themes list table.

add_action('after_theme_row', 'add_custom_data_after_theme_row', 10, 3);

function add_custom_data_after_theme_row($stylesheet, $theme, $status) {
    if ('your-theme' === $stylesheet) {
        echo '**Custom Data: ' . get_custom_data($theme) . '**';
    }
}

function get_custom_data($theme) {
    // Retrieve custom data for the given theme
    // This is just a placeholder function for demonstration purposes
    return 'Sample custom data';
}