Skip to content

Instantly share code, notes, and snippets.

@mahfelwp
Created June 23, 2019 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahfelwp/a10f901314a8c12d6d394ab5e5694efa to your computer and use it in GitHub Desktop.
Save mahfelwp/a10f901314a8c12d6d394ab5e5694efa to your computer and use it in GitHub Desktop.
Verified users count shortcode in Youzer plugin
<?php
function yz_verified_users_count_shortcode( $atts = null ){
global $wpdb;
// Get Args.
$args = shortcode_atts(
array(
'verified' => 'on',
), $atts, 'yz_verified_users_count' );
$request = "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = 'yz_account_verified' AND meta_value = '{$args["verified"]}'";
$users = $wpdb->get_col( $request );
return count($users);
}
add_shortcode( 'yz_verified_users_count', 'yz_verified_users_count_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment