jetpack_stats_post_table_cell

Set content for cell with link to an entry's stats in WordPress.com.

Description

jetpack_stats_post_table_cell( (string) $column, (int) $post_id ); 

Parameters (2)

0. $column (string)
The name of the column to display.
1. $post_id (int)
The current post ID.

Usage

  1. if ( !function_exists( 'jetpack_stats_post_table_cell' ) ) { 
  2. require_once '/modules/stats.php'; 
  3.  
  4. // The name of the column to display. 
  5. $column = ''; 
  6.  
  7. // The current post ID. 
  8. $post_id = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = jetpack_stats_post_table_cell($column, $post_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/stats.php  
  1. function jetpack_stats_post_table_cell( $column, $post_id ) { 
  2. if ( 'stats' == $column ) { 
  3. if ( 'publish' != get_post_status( $post_id ) ) { 
  4. printf( 
  5. '<span aria-hidden="true">*</span><span class="screen-reader-text">%s</span>',  
  6. esc_html__( 'No stats', 'jetpack' ) 
  7. ); 
  8. } else { 
  9. printf( 
  10. '<a href="%s" title="%s" class="dashicons dashicons-chart-bar" target="_blank"></a>',  
  11. esc_url( "https://wordpress.com/stats/post/$post_id/" . Jetpack::build_raw_urls( get_home_url() ) ),  
  12. esc_html__( 'View stats for this post in WordPress.com', 'jetpack' ) 
  13. );