Skip to content

Commit

Permalink
Merge pull request #27 from bradt/twitter-link-in-admin
Browse files Browse the repository at this point in the history
Add Twitter.com link to post listing.
  • Loading branch information
alexkingorg committed Feb 6, 2014
2 parents 9f3a54e + cea42f5 commit 8d37bd5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions classes/aktt.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static function init() {
add_action('admin_init', array('AKTT', 'admin_controller'), 1);
add_action('admin_menu', array('AKTT', 'admin_menu'));
add_filter('plugin_action_links', array('AKTT', 'plugin_action_links'), 10, 2);
add_filter('post_row_actions', array('AKTT', 'post_row_actions'), 10, 2);
add_action('admin_enqueue_scripts', array('AKTT', 'admin_enqueue_scripts'));

// Cron Hooks
Expand Down Expand Up @@ -414,6 +415,20 @@ static function the_posts($posts) {
return $posts;
}

/**
* Appends a "View on Twitter.com" link to post listing quick links
*
* @param array $actions
* @param object $post Post object
* @return array
*/
function post_row_actions($actions, $post) {
if (isset($post->tweet)) {
$actions['view-on-twitter'] = '<a href="' . esc_url($post->tweet->status_url()) . '">' . __( 'View on Twitter.com', 'twitter-tools' ) . '</a>';
}
return $actions;
}

/**
* Prepends a "settings" link for our plugin on the plugins.php page
*
Expand Down

0 comments on commit 8d37bd5

Please sign in to comment.