これだと、記事にアクセスがあったときに毎回 Twitter API 叩いて、Twitter サーバーにいらん負荷をかけちゃうので、WordPress の Transient API 使って、キャッシュを取得するようにしたほうが良いと思う。
あと WP 使うんなら file_get_contents() ではなく、wp_remote_get() 使ったほうが、何かと便利。
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