我有一个自定义的贴子类型,名为Neighborhoods,它存储有关一个城市的各个社区的信息。每个社区都有一个Facebook页面。我想为每个社区做的是,使用Facebook图表获取页面的赞数,并将其保存在WordPress数据库中,以显示在我网站的各个部分。
我不知道要使用什么代码,但下面是基本的大纲:
Run this once a day:
Query neighborhood post type in the database
For each neighborhood:
$data = json_decode(file_get_contents(\'https://graph.facebook.com/neighborhoodURL\'));
$numberOfLikes = $data->likes;
Save $numberOfLikes in it\'s own field in the database
一旦设置好了,我应该能够调用循环中的喜欢数字段。有人知道最好的方法吗?