-
-
Notifications
You must be signed in to change notification settings - Fork 28
Filter Hook to Adding Custom Status Labels
Frank Bültge edited this page Sep 28, 2015
·
1 revision
Currently only on the dev version, available on github:
Add a simple icon for when the Super Cache module is disabled for the website.
add_filter( 'multisite_enhancements_status_label', 'custom_site_status_labels', 10, 2 );
function custom_site_status_labels( $string, $blog) {
// change the default labels
$string = str_replace( 'dashicons-dismiss', 'dashicons-hidden', $string );
// Get the blog ID
$site_id = (int) $blog->userblog_id;
// In this case, check if cache is disables on this blog
$is_cache_disabled = (int) get_blog_option( $site_id, 'wp_super_cache_disabled' );
// If disabled, add an extra icon!
// (I've used the dismiss icon which I've changes above)
if ( 1 === $is_cache_disabled ) {
$title = esc_attr__( 'cached', 'multisite_enhancements' );
$class = 'ab-icon dashicons-before dashicons-dismiss';
$cache_hint = '<span title="' . $title . '" class="' . $class . '"></span>';
return $cache_hint . $string;
}
// Allways return the default if something else isn't returned before.
return $string;
}
Other WordPress Multisite Solution in my network:
- MultilingualPress The right way to build a multilingual WordPress site!