Skip to content

Instantly share code, notes, and snippets.

@angelcosta

angelcosta/madmimi.php

Last active May 10, 2021
Embed
What would you like to do?
MadMimi - Subscribers counter
//Add this to your functions.php then use the shortcode [mmsubscribers] to show your list numbers
function subscribers_madmimi() {
$transient = get_transient( 'subscribers_madmimi' );
if( ! empty( $transient ) ) {
return $transient;
} else {
$username = "your email at madmimi";
$apikey = "your api key";
$response = wp_remote_retrieve_body( wp_remote_get( "https://api.madmimi.com/audience_members.json?username=$username&api_key=$apikey" ) );
$json = json_decode( $response, true );
$assinantes = number_format($json[count], '0',',','.');
set_transient( 'subscribers_madmimi', $subscribers, HOUR_IN_SECONDS );
return $subscribers;
}
}
add_shortcode( 'mmsubscribers', 'subscribers_madmimi' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment