Aurangajeb

Add new table head and comment count row on WPUF dashboard table

Aug 18th, 2020 (edited)
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. /**
  2. * @Add a new column header in dashboard table
  3. * @param array $args dashboard query arguments
  4. * @return void
  5. */
  6. function wpufe_dashboard_add_comment_head( $args ) {
  7. printf( '<th>%s</th>', __( 'Comments', 'wpuf' ) );
  8. }
  9. add_action( 'wpuf_dashboard_head_col', 'wpufe_dashboard_add_comment_head', 10, 2 );
  10.  
  11.  
  12.  
  13. /**
  14. *
  15. * Display comment count on the row
  16. *
  17. */
  18. function wpufe_dashboard_row_col_comment( $args, $post ) {
  19.     ?>
  20.     <td>
  21.     <?php
  22.     echo $post->comment_count;
  23.     ?>
  24.     </td>
  25.     <?php
  26. }
  27.  
  28. add_action( 'wpuf_dashboard_row_col', 'wpufe_dashboard_row_col_comment', 10, 2 );
  29.  
  30.  
Add Comment
Please, Sign In to add comment