我正在尝试使某些推文中包含的链接在我的推特小部件上工作,例如,当我推特一张图片并且推特将其变成一个短链接时。这是代码...提前感谢您的帮助!
if ( !function_exists( 'wp_echo_twitter' ) ) {
function wp_echo_twitter($username) {
include_once( ABSPATH . WPINC . '/class-simplepie.php' );
// Fetch feed, set cache locaiton, and initialize function
$feed = new SimplePie();
$feed->set_feed_url("http://twitter.com/statuses/user_timeline/$username.atom?count=200");
$feed->set_cache_location( ABSPATH . WPINC );
$feed->init();
$feed->handle_content_type();
// Output tweet
foreach ($feed->get_items(0, 1) as $item):
echo '<p class="hero-p" style="margin-bottom: 9px;">"' . $item->get_description() . '"</p>' . '<span><a href="' . $item->get_permalink() . '">' . $item->get_date('D, M j, Y') . '</a></span>';
endforeach;
}
}