Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display count of total activities / posts

Viewing 1 replies (of 1 total)

  • crazydjp
    Participant

    @crazydjp

    Okay I figured it out.

    add_shortcode( 'get_total_activity_count', 'get_total_activity_count');
    function get_total_activity_count(){
    
    	global $wpdb;
     
    	$total_activity_count = $wpdb->get_var( "SELECT COUNT(*) FROM activity_database_name
    					  WHERE (component = 'activity' OR component = 'groups') 
    					  AND   type = 'activity_update'
                                             ");
    	return $total_activity_count;
    }

    And then using this shortcode [get_total_activity_count] to display on the frontend.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar