我想为帖子URL创建包含类似facebook的自定义字段,以获得我使用此代码的喜好
function fb_count(){
$link = get_permalink($post->ID);
$content = file_get_contents("http://api.facebook.com/restserver.php?method=links.getStats&urls=".$link);
$element = new SimpleXmlElement($content);
$shareCount = $element->link_stat->total_count;
return $shareCount;}
我不知道如何在自定义字段中存储Facebook数据我尝试了此代码,但它不起作用<?php $like_key = \'likes_count\';
$link = get_permalink($id);
$content = file_get_contents("http://api.facebook.com/restserver.php? method=links.getStats&urls=".$link);
$element = new SimpleXmlElement($content);
$shareCount = $element->link_stat->total_count;
$key1_values = get_post_custom_values($like_key, $id);
foreach ( $key1_values as $value )
update_post_meta($id,$like_key,$shareCount, $value); ?>
我想知道我做错了什么