Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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