Skip to content

Instantly share code, notes, and snippets.

View bkatusic's full-sized avatar

Bojan Katusic bkatusic

View GitHub Profile
@bkatusic
bkatusic / gist:f3413a36b0fe7c2038a21370480ad475
Last active April 17, 2024 18:32
Displays the Notes content in Manage Sites tale
add_filter( 'mainwp_sitestable_display_row_columns', 'mycustom_mainwp_sitestable_display_row_columns', 10, 3 );
function mycustom_mainwp_sitestable_display_row_columns( $false_val , $column, $website ){
if( 'notes' === $column && ! empty( $website['note'] ) ){
$note = wp_strip_all_tags( html_entity_decode( $website['note'] ) );
return substr( $note, 0, 50 );
}
return false;
}
@bkatusic
bkatusic / gist:fb7a6e3ad231afafcfce4974f4ac4169
Created March 24, 2023 16:52
MainWP - Count users on Child Sites
$result = count_users();
echo 'There are ', $result['total_users'], ' total users';
foreach( $result['avail_roles'] as $role => $count ) {
echo ', ', $count, ' are ', $role, 's';
}
echo '.';
@bkatusic
bkatusic / gist:12735d074ca1fef1c6527bffc986b6c7
Created January 2, 2023 18:25
Adding Google Analytics script to functions.php file
add_action('wp_head','my_analytics', 20);
function my_analytics() {
?>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-26113989-28"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '26113989-28');