Aurangajeb

Add a new column header in dashboard table

Feb 3rd, 2020 (edited)
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. /**
  2. Doc Link- https://wedevs.com/docs/wp-user-frontend-pro/tutorials/adding-columns-to-dashboard-table/
  3.  
  4. * Add a new column header in dashboard table
  5. *
  6. * @param array $args dashboard query arguments
  7. * @return void
  8. */
  9. function wpufe_dashboard_change_head( $args ) {
  10. printf( '<th>%s</th>', __( 'Custom Title', 'wpuf' ) );
  11. }
  12. add_action( 'wpuf_dashboard_head_col', 'wpufe_dashboard_change_head', 10, 2 );
  13.  
  14.  
  15. /** Add a new table cell to the dashboard table rows.
  16.  
  17. * It adds a form for changing the post status of each posts via ajax call.
  18. *
  19. * @param array $args dashboard query arguments
  20. * @param object $post current rows post object
  21. * @return void
  22. */
  23.  
  24.  
  25. function wpufe_dashboard_row_col( $args, $post ) {
  26. ?>
  27. <td>
  28. <?php
  29. if ( $sub = get_post_meta( $post->ID, 'subhead', true ) ) {
  30. echo $sub;
  31. } else {
  32. echo 'Custom Row';
  33. }
  34. ?>
  35. </td>
  36. <?php
  37. }
  38. add_action( 'wpuf_dashboard_row_col', 'wpufe_dashboard_row_col', 10, 2 );
Add Comment
Please, Sign In to add comment