$data_arr['post_id'], 'auto_post' => $data_arr['auto_post'] // 1 or empty ); $post_id = $data_arr['post_id']; $title = ATASWP_Twitter_Tweet::get_post_title( $post_id ); $description = ATASWP_Twitter_Tweet::create_post_description( $post_id ); $url = ATASWP_Twitter_Tweet::get_post_url( $post_id ); $author = ATASWP_Twitter_Tweet::get_post_author( $post_id ); // replace words with defined hashtags $title = ATASWP_Twitter_Tweet::words_to_hashtags( $title ); $description = ATASWP_Twitter_Tweet::words_to_hashtags( $description ); $tweet = array( "title" => $title, "description" => $description, "url" => $url, "author" => '@'.$author ); $tweet = json_encode($tweet); // json encode before send $response = ATASWP_Twitter::tweet( $tweet ); // process tweet if ( !empty($response) ) { // success, show admin notice using transient set_transient( 'ataswp_auto_post_metabox_tweet_result', true, 180 ); // for 180 seconds } return $response; /* echo '
'; print_r( $tweet ); echo ''; echo '
'; print_r( $twitterdata ); echo ''; exit; */ } /** * Display admin notice upon on tweet. * * @since 1.0.0 * @return void $notice */ public function auto_post_metabox_tweet_notice() { if ( ! current_user_can( 'activate_plugins' ) ) return; $notice = ''; // def // If transient exist if ( get_transient( 'ataswp_auto_post_metabox_tweet_result' ) ) { $tweet_button = 'Tweet'; $notice = '
' . __('Tweet successfully posted.', 'ataswp_lang') . '
' . '' . __('Share your Love by Tweeting to us: ', 'ataswp_lang') . $tweet_button . '
' . '