Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
Created December 13, 2018 01:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/2a16824c7a95676d251965647c7569d8 to your computer and use it in GitHub Desktop.
Save KaineLabs/2a16824c7a95676d251965647c7569d8 to your computer and use it in GitHub Desktop.
Get The Total Activities Number Shortcode [yzc_get_total_activities]
<?php
/**
* Get The Total Activities Number.
*/
function yzc_get_site_total_activities_number() {
global $bp,$wpdb;
$total = $wpdb->get_var( "SELECT COUNT(*) FROM {$bp->activity->table_name} WHERE component = 'activity' AND type != 'activity_comment' ");
if( ! empty( $total ) ) {
echo sprintf( __( '%d activities', 'youzer' ) , $total );
}
}
add_shortcode( 'yzc_get_total_activities', 'yzc_get_site_total_activities_number' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment