Skip to content

Instantly share code, notes, and snippets.

@pstoute
Last active April 21, 2021 09:03
Show Gist options
  • Save pstoute/90a128788610451a2760fd5249ebbee8 to your computer and use it in GitHub Desktop.
Save pstoute/90a128788610451a2760fd5249ebbee8 to your computer and use it in GitHub Desktop.
FluentCRM Subscriber Count Shortcode
<?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