Last active
April 21, 2021 09:03
-
-
Save pstoute/90a128788610451a2760fd5249ebbee8 to your computer and use it in GitHub Desktop.
FluentCRM Subscriber Count Shortcode
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 | |
/** | |
* Plugin Name: FluentCRM Subscriber Count | |
* Version: 1.0 | |
* Description: Adds a shortcode [fluentcrm_subscriber_count] | |
*/ | |
function stoute_fcrm_subscriber_count($atts) | |
{ | |
global $wpdb; | |
$a = shortcode_atts(array( | |
'status' => 'subscribed', | |
), $atts ); | |
$status = esc_attr($a['status']); | |
$table = "{$wpdb->prefix}fc_subscribers"; | |
$results = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $table WHERE status = '%s'", $status )); | |
return $results; | |
} | |
add_shortcode('fluentcrm_subscriber_count', 'stoute_fcrm_subscriber_count'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment