diff --git a/modules/stats.php b/modules/stats.php
index e7de5f513ca49..65bbc9d707b3d 100644
--- a/modules/stats.php
+++ b/modules/stats.php
@@ -52,6 +52,13 @@ function stats_load() {
add_filter( 'pre_option_db_version', 'stats_ignore_db_version' );
+
+ // Add an icon to see stats in WordPress.com for a particular post
+ add_action( 'admin_print_styles-edit.php', 'jetpack_stats_load_admin_css' );
+ add_filter( 'manage_posts_columns', 'jetpack_stats_post_table' );
+ add_filter( 'manage_pages_columns', 'jetpack_stats_post_table' );
+ add_action( 'manage_posts_custom_column', 'jetpack_stats_post_table_cell', 10, 2 );
+ add_action( 'manage_pages_custom_column', 'jetpack_stats_post_table_cell', 10, 2 );
}
/**
@@ -1343,3 +1350,69 @@ function stats_get_from_restapi( $args = array(), $resource = '' ) {
return $data;
}
+
+/**
+ * Load CSS needed for Stats column width in WP-Admin area.
+ *
+ * @since 4.7.0
+ */
+function jetpack_stats_load_admin_css() {
+ ?>
+
+ —%s',
+ esc_html__( 'No stats', 'jetpack' )
+ );
+ } else {
+ printf(
+ '',
+ esc_url( "https://wordpress.com/stats/post/$post_id/" . Jetpack::build_raw_urls( get_home_url() ) ),
+ esc_html__( 'View stats for this post in WordPress.com', 'jetpack' )
+ );
+ }
+ }
+}