Last active
December 6, 2018 14:02
-
-
Save bogdan-mainwp/d59d51b615295ec09832c101d9a948e8 to your computer and use it in GitHub Desktop.
Custom code snippet for creating a custom WP Version column in the Manage Sites table and displaying Child Site WP version for each child site.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin | |
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations | |
// More about the plugin: https://mainwp.com/mainwp-customisations/ | |
// WP Version example | |
add_filter( 'mainwp-sitestable-getcolumns', 'mycustom_sites_table_column', 10 ); | |
add_filter( 'mainwp-sitestable-item', 'mycustom_sitestable_item', 10 ); | |
function mycustom_sites_table_column( $cols ) { | |
$cols['wpversion'] = 'WP Version'; | |
return $cols; | |
} | |
function mycustom_sitestable_item( $item ) { | |
$options = apply_filters('mainwp_getwebsiteoptions', array(), $item['id'], 'site_info'); | |
$website_info = json_decode( $options, true ); | |
if (is_array($website_info) && isset($website_info['wpversion'])) { | |
$item['wpversion'] = $website_info['wpversion']; | |
} else { | |
$item['wpversion'] = ''; | |
} | |
return $item; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment