Custom Query
-
I am not a programmer and I am probably missing something really obvious. I have custom tags installed and setup for my groups. I want to run a query that displays the total count of how many groups has a certain tag.
I have been trying something like this. Any ideas?
`
function TagCount() {
global $wpdb, $bp;
$var_count = $wpdb->get_var(“SELECT count( * ) FROM $bp->groups_groupmeta WHERE meta_key = ‘gtags_group_tags’ AND meta_value = ‘%MyTag%’;”);echo ‘count is ‘ . $var_count . ”;
}
add_shortcode(‘tagcount’, ‘TagCount’);
?>
`
You must be logged in to reply to this topic.