Wordpress的Twitter功能
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress的Twitter功能相关的知识,希望对你有一定的参考价值。
function get_twitter($username){ /* From http://www.wprecipes.com/how-to-display-your-latest-twitter-entry-on-your-wp-blog/comment-page-2#comment-114746 */ $prefix = "<p>"; $suffix = "</p>"; $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1"; function parse_feed($feed) { $tweet = $stepTwo[0]; return $tweet; } function curr_date($feed) { $tweet_time = $stepTwo[0]; return $tweet_time; } /* If your running php > 5.3 you need to set this or your app will throw errors */ /* Added from Skidoosh at http://www.skidoosh.co.uk/php/create-twitter-like-date-formatted-strings-with-php/ */ function twitter_time_format ($date) { ); #Get the time from the function arg and the time now #Get the time diff in seconds $diff = $nowtime - $argtime; #Store the results of the calculations #Calculate the largest unit of time $title = $blocks[$i][0]; $calc = $blocks[$i][1]; if ($units > 0) { $res[$title] = $units; } } $format = "About %s %s %s %s ago"; $year_label = $res['year'] > 1 ? 'years' : 'year'; $month_label = $res['month'] > 1 ? 'months' : 'month'; } else { $format = "About %s %s ago"; $year_label = $res['year'] > 1 ? 'years' : 'year'; } } $format = "About %s %s %s %s ago"; $month_label = $res['month'] > 1 ? 'months' : 'month'; $day_label = $res['day'] > 1 ? 'days' : 'day'; } else { $format = "About %s %s ago"; $month_label = $res['month'] > 1 ? 'months' : 'month'; } } if ($res['day'] == 1) { } if ($res['day'] <= 7) { } if ($res['day'] <= 31) { } } if ($res['hour'] > 1) { } else { return "About an hour ago"; } } if ($res['min'] == 1) { return "About one minut ago"; } else { } } if ($res['sec'] == 1) { return "One second ago"; } else { } } } return stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix).'<p class="tweet_time">'.twitter_time_format(curr_date($twitterFeed)).'</p>'; }
以上是关于Wordpress的Twitter功能的主要内容,如果未能解决你的问题,请参考以下文章