Do you want to display the number of MailChimp subscribers? Recently, one of our users asked us how they can display the number of MailChimp subscribers in WordPress. Displaying social proof encourages other users to join your newsletter. In this article, we will show you how to display the number of MailChimp subscribers in WordPress.
MailChimp is one of the most beginner-friendly email marketing service providers. If you're not already using MailChimp, check out our guide on using MailChimp with WordPress.
We will show two different methods to display the number of MailChimp subscribers. The first method is easier and requires you to install a WordPress plugin. The second method is more advanced where you will need to create a plugin based on different source files. If you are not familiar with editing code snippets, we recommend that you use the first method.
The first thing you need to do is install and activate the MailChimp Subscriber Chiclet plugin. Upon activation, visit Settings »MailChimp Subscriber Chiclet to configure the plugin.
You will first need to enter your MailChimp API key. If you haven't created one, you can log in to your MailChimp account dashboard and get one.
After entering your API key, click the Save Changes button. The plugin will load your email list from your MailChimp account. Select your email list and configure plugin settings.
Once you're done, simply copy the shortcode from the bottom of the plugin and add it to any post, page or text widget where you'd like to display the number of subscribers.
As you will notice that by using the plugin method, you will get the number of subscribers with the MailChimp logo. Many users would just want to get the number so they can use it with their own email signup forms.
In this method we are going to create a plugin. This plugin will use the MailChimp API to get the number of subscribers. You will be able to display the number of subscribers anywhere you want using a shortcode.
Step 1: The first thing you need to do is create a folder on your desktop and name it mc-subscriber-count.
Step 2 Inside the folder, create a new file and name it mc-subscriber-count.php and paste this code inside it.
Important: Don't forget to replace the Your_MailChimp_API_Key with your actual MailChimp API key.
= 86400) $ MailChimp = nuevo MailChimp ('Your_MailChimp_API_Key'); $ mc = $ MailChimp-> call ('listas / lista'); $ subscriber_count. = $ mc [data] [0] [stats] [member_count]; file_put_contents ($ lastRunLog, time ()); file_put_contents ($ subfile, $ subscriber_count); else $ subscriber_count. = file_get_contents ($ subfile); devolver number_format ($ subscriber_count); add_shortcode ('mc-subscribers', 'wpb_mc_sub_count'); add_filter ('widget_text', 'do_shortcode'); ?>
Step 3: Inside the mc-subscriber-count folder, create another folder and name it the name you register. Inside the logs folder, create two blank files using a plain text editor like Notepad. Name one file lastrun.log and the other subcount.log.
Stage 4: Download the MailChimp PHP Wrapper source code from the MailChimp repository. The download link is at the bottom of the right column.
After downloading, you need to extract the zip file. Inside the extracted folder, you will see a src folder containing the Mailchimp.php file and the Mailchimp folder.
Step 5: Copy and paste the Mailchimp.php file and Mailchimp folder into your plugins folder.
Step 6: Upload the mc-subscriber-count folder to the /wp-content/plugins/ folder on your website using an FTP client.
Step 7: Visit the Plugins page in the WordPress admin area and activate the MailChimp Subscriber Count plugin.
Step 8: Use shortcode [mc-suscriptores]
to display the number of MailChimp subscribers on any post, page or text widget in WordPress.
We hope this article helped you display MailChimp subscriber count as text on your WordPress site.
If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.