Created
December 13, 2018 01:09
-
-
Save KaineLabs/2a16824c7a95676d251965647c7569d8 to your computer and use it in GitHub Desktop.
Get The Total Activities Number Shortcode [yzc_get_total_activities]
This file contains 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 | |
/** | |
* 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