Top 3 posts in last week ordered by Facebook and Twitter share counts

This is a bit of a multi-part question, so you’re getting a multi-part answer. Getting the Facebook count can be done by making a request to https://graph.facebook.com/URL. This will return a json object which contains, among other things, the number of “shares”. Working example which has 4 shares as of this writing: https://graph.facebook.com/http://ottopress.com/2011/wp-quickie-adding-chrome-voice-search/ Getting the … Read more

publish_post hook isn’t working for scheduled posts

I reworked (added another version of) my function to remove the if statement to check post status, as the post is scheduled to publish it turns out i don’t need to check it again. /* the function */ function tcr_tweet2($postID) { /* get the post that’s being published */ $post = get_post($postID); $post_title = $post->post_title; … Read more

Importing Tweets with certain hashtags into WordPress

I wrote a shortcode function based on “Twitter Hash Tag Widget” plugin just copy this function to your themes functions.php file function tweets_by_hashtag_9867($atts, $content = null){ extract(shortcode_atts(array( “hashtag” => ‘default_tag’, “number” => 5, ), $atts)); $api_url=”http://search.twitter.com/search.json”; $raw_response = wp_remote_get(“$api_url?q=%23$hashtag&rpp=$number”); if ( is_wp_error($raw_response) ) { $output = “<p>Failed to update from Twitter!</p>\n”; $output .= “<!–{$raw_response->errors[‘http_request_failed’][0]}–>\n”; $output … Read more

WordPress Internal @ Mentions

This is a little tricky because sanitize_user allows spaces in usernames, meaning it difficult to avoid grabbing the whole phrase ‘@johndoe said that … ‘ as opposed to just the actual username ‘@johndoe’ and you have no separator at the end that would help. To avoid that I imposed a requirement that spaces in the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)