Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressでMailchimp購読者数を表示する方法

MailChimpの購読者数を表示したいですか?最近、あるユーザーからWordPressでMailChimpの購読者数を表示する方法を尋ねられました。ソーシャルプルーフを表示することで、他のユーザーにニュースレターへの参加を促すことができます。この投稿では、WordPressでMailChimpの購読者数を表示する方法を紹介します。

MailChimpは最も初心者向けのメールマーケティングサービスプロバイダーの一つです。まだMailChimpをご利用でない方は、WordPressでMailChimpを利用するガイドをご覧ください。

今回は、MailChimpの購読者数を表示する2つの異なる方法をご紹介します。最初の方法は簡単で、WordPressプラグインをインストールする必要があります。2つ目の方法はより高度で、異なるソースファイルに基づいてプラグインを作成する必要があります。コードスニペットを編集するのが苦手な方は、最初の方法をお勧めします。

方法1: Mailchimp購読者プラグインを使用する。

まず最初に、MailChimpSubscriber Chiclet プラグインをインストールして有効化します。有効化したら、設定 ” MailChimp Subscriber Chicletにアクセスしてプラグインを設定します。

MailChimp Subscriber Chiclet Settings

最初にMailChimp APIキーを入力する必要があります。まだ作成されていない場合は、ダッシュボードにログインして取得してください。

Getting API Keys for your MailChimp account

APIキーを入力したら、変更を保存ボタンをクリックしてください。プラグインがMailChimpアカウントからメールリストを読み込みます。メールリストを選択し、プラグインの設定を行います。

設定が完了したら、プラグイン下部からショートコードをコピーし、購読者数を表示したい投稿、ページ、テキストウィジェットに追加してください。

Preview of Mailchimp subscriber chiclet plugin

方法2: MailChimp APIを使用して購読者数を取得する

プラグインを使用する方法では、Powered by MailChimpのロゴが表示された購読者数を取得することができます。多くのユーザーは、自分のメール登録フォームで使用できるように、数を取得したいだけでしょう。

この方法ではプラグインを作成します。このプラグインはMailChimpのAPIを使って購読者数を取得します。ショートコードを使って、購読者数を好きな場所に表示できるようになります。

ステップ1:まず最初に、デスクトップにフォルダーを作成し、mc-subscriber-countという名前を付けます。

ステップ2:フォルダー内に新規ファイルを作成し、mc-subscriber-count.phpと名付け、このコードを貼り付けます。

重要:Your_MailChimp_API_Key を実際の Mailchimp API Key に置き換えるのを忘れないでください。

[cbk1]

ステップ3:mc-subscriber-countフォルダーの中に別のフォルダーを作成し、名前をlogsとします。logsフォルダーの中に、メモ帳のようなプレーンテキストエディターを使って2つの空のファイルを作成します。ファイル名をlastrun.logとし、もう1つをsubcount.logとする。

Creating log files

ステップ 4:MailChimpリポジトリから、MailChimp PHP Wrapperのソースコードをダウンロードします。ダウンロードリンクは、右側の列の一番下にあります。

ダウンロード後、zipファイルを解凍してください。解凍したフォルダーの中に、Mailchimp.phpファイルとMailchimpフォルダーを含むフォルダーsrcがあります。

MailChimp API Files

ステップ5:Mailchimp.phpファイルとMailchimpフォルダをプラグインフォルダにコピー&ペーストします。

Final plugin file structure

ステップ6: FTPクライアントを使用して、サイトの/wp-content/plugins/フォルダにmc-subscriber-countフォルダをアップロードします。

ステップ7: WordPress 管理エリアのプラグインページにアクセスし、MailChimp Subscriber Count プラグインを有効化します。

ステップ8: ショートコード[mc-subscribers]を使用して、WordPress の投稿、ページ、テキストウィジェットに MailChimp の購読者数を表示します。

この投稿があなたのWordPressサイトにMailChimp購読者数をテキストで表示するのにお役に立てば幸いです。

この投稿が気に入った場合は、WordPressの動画チュートリアルをYouTubeチャンネルに登録してください。Twitterや Facebookでもご覧いただけます。

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

アバター

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

17件のコメント返信を残す

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

    • WPBeginner Support says

      Thank you for letting us know the methods are not working for you, we’ll certainly take a look.

      管理者

  2. Bernd says

    Method 1: plugin is outdated.
    Method 2: causes a “fatal error” on activating the plugin

    Any suggestions? Thx.

    • Josh says

      Seriously, as above. Keep getting fatal errors. And it seems like nobody is bothering to reply here. Kind of unfortunate.

  3. Benny says

    This does NOT work.
    Don’t even bother following his methods.
    Method #1 is outdated and not supported.
    Method #2 you will be surrounded by
    “Fatal error: Cannot redeclare class whatever on line whatever

  4. Mel Reiff Hill says

    Thanks for the code, but the diy plugin seem to no longer work (I show 0 subscribers after following instrux…) Just thought it might be worth an update!

  5. Dave says

    Thanks for the awesome tutorial. Can you kindly explain how to specify which list to count, in the case of having multiple mailchimp lists?

    At the bottom of lists.php, I tried adding my list_id into the $filters array, as such:

    public function getList($filters=array(‘list_id’ => ‘abc123’),…

    (with abc123 corresponding to my actual list_id)

    But this didn’t seem to work. Or should I expect a long delay time before it starts working?

    Thanks,
    Dave

  6. Chris says

    The plugin is horrible: using an image as background!

    For those who like to use it AND get rid of the logo and the bad typo and bad styling, here is the CSS to get rid of it; put it in the custom.css of your theme:

    .mailchimp-subscriber-chiclet-for-wordpress .mailchimp-subscriber-chiclet-for-wordpress-wrapper .mainButton {
    background-color: #B09AAB;
    background-image: none !important;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 14px;
    height: 30px;
    text-align: center;
    width: auto;
    padding-top: 3px;
    }

    With this it looks nice with my theme:

  7. Alex says

    Hi,

    cant you do something simialr using the optinmonster sidebar, but without a real time count?

    Thanks.
    Alex

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。