Created
May 23, 2016 20:20
-
-
Save cogdog/2934cddc5e1f4f446ff84a44618fff82 to your computer and use it in GitHub Desktop.
Dailyblank Fetch Some Tweets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// I used this when testing the twitter fetching, | |
// it will give you sense of what tweets will be fetched | |
// for a Daily blank site. Insert into the magic spot of page-debug.php, go to /debug on your | |
// site, let it do its work, then remove. | |
$tweets = getTweets( dailyblank_option('twitteraccount'), 200, array('exclude_replies'=>false, 'trim_user' => false ) ); | |
// walk through the tweets | |
foreach($tweets as $tweet) { | |
// array for hashtags | |
$hashtags = extract_hashtags( $tweet['entities']['hashtags'] ); | |
// We want only replies with hashtags and URLs in 'em | |
if ( $hashtags ) { | |
// check for hashtag match against our dailyblank base | |
if ( dailyblank_tag_in_hashtags( $hashtags, dailyblank_option('basetag') ) ) { | |
// bingo we got a winner; | |
// form URL for the tweet | |
$t_url = 'https://twitter.com/' . $tweet['user']['screen_name'] . '/status/' . $tweet['id_str']; | |
echo wp_oembed_get( $t_url ); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment