Skip to content

Instantly share code, notes, and snippets.

@sjaved87
Last active September 2, 2016 18:34
Show Gist options
  • Save sjaved87/ac4284f1d7b4408986e3e25587d5fbe4 to your computer and use it in GitHub Desktop.
Save sjaved87/ac4284f1d7b4408986e3e25587d5fbe4 to your computer and use it in GitHub Desktop.
WPMU DEV Events+ plugin - This snippet will count and return the active events.
<?php
function get_active_events_count(){
global $wpdb;
$count = $wpdb->get_var(
$wpdb->prepare(
"SELECT count(*)
FROM $wpdb->postmeta
WHERE meta_key = %s
and meta_value = %s ",
'incsub_event_status',
'open'
)
);
return $count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment