Using WordPress ‘after_theme_row_{$stylesheet}’ PHP action

The after_theme_row_{$stylesheet} WordPress PHP action fires after each specific row in the Multisite themes list table.

Usage

add_action('after_theme_row_exampletheme', '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_{$stylesheet}

Examples

Add a custom action link to the specific theme row in the Multisite themes list table.

add_action('after_theme_row_exampletheme', 'add_custom_action_link', 10, 3);

function add_custom_action_link($stylesheet, $theme, $status) {
    echo '<a href="your-custom-link">Custom Link</a>';
}

Display custom message based on theme status

Display a custom message after the theme row based on the theme’s status.

add_action('after_theme_row_exampletheme', 'display_custom_message', 10, 3);

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

Display theme version

Show the theme version after the theme row.

add_action('after_theme_row_exampletheme', 'display_theme_version', 10, 3);

function display_theme_version($stylesheet, $theme, $status) {
    echo 'Theme version: ' . $theme->get('Version');
}

Display custom message for specific theme

Display a custom message after a specific theme row.

add_action('after_theme_row_exampletheme', 'display_custom_message_for_theme', 10, 3);

function display_custom_message_for_theme($stylesheet, $theme, $status) {
    if ($stylesheet == 'exampletheme') {
        echo 'This is the Example Theme.';
    }
}

Add custom CSS class to theme row

Add a custom CSS class to the specific theme row in the Multisite themes list table.

add_action('after_theme_row_exampletheme', 'add_custom_css_class', 10, 3);

function add_custom_css_class($stylesheet, $theme, $status) {
    echo '<style>.theme.exampletheme { background-color: #f5f5f5; }</style>';
}