我正在使用一个插件,该插件将根据用户位置显示内容,我正在尝试将其添加到facebook小部件代码中。该插件使用了一个短代码来包装将要显示的内容,下面是我到目前为止的内容。我知道我做错了什么,如果你能给我指出正确的方向,我将不胜感激。
if (($user_id) and ($app_id) and ($secret_code)){
$user_data = get_option(\'wt_recent_fb_posts_user\');
echo do_shortcode (\'[wpgc_is_city city="Morrisville"]\');
if ((!$user_data) OR ($user_data[0]->id !== $user_id)){
$user_data = $this -> fetch_userdata($user_id);
}
$fb_posts = get_transient(\'wt_recent_fb_posts\');
if (!$fb_posts){ //no messages, fetch from facebook
$fb_posts = $this->fetch_fbposts($user_id, $post_count, $app_id, $secret_code);
} else {
$fb_posts = get_transient( \'wt_recent_fb_posts\' );
}
if(isset($user_data[0]->name)){
echo "<div class=\'user\'><h3><a href=\'".$user_data[0]->url."\' target=\'_blank\'>".$user_data[0]->name."</a></h3></div>";
} else {
echo "<div class=\'user\'>Facebook</div>";
}
echo "<div class=\'fb-posts-list\'><ul class=\'slides\'>";
foreach ($fb_posts as $fb_post) {
echo "<li>";
echo "<div class=\'message\'>".$fb_post->message."</div>";
$created_time = $fb_post->created_time;
$time_ago = sprintf(__(\'%s ago\', \'wellthemes\'), human_time_diff(strtotime($created_time)));
echo "<div class=\'time\'>".$time_ago."</div>";
echo "</li>";
}
echo "</ul></div><div class=\'fb-posts-nav\'></div>";
echo do_shortcode(\'[/wpgc_is_city]\');
}