Guest User

Untitled

a guest
Jan 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. update_post_meta( $company_id, 'profile_updated_on', current_time( 'timestamp', 0 ) );
  2.  
  3. meta_key meta_value
  4. 1) profile_updated_on 1516763741
  5. 2) profile_updated_on 1516691767
  6. 3) profile_updated_on 1516691769
  7.  
  8. // Add the custom columns to the organization post type:
  9. add_filter( 'manage_edit-organization_columns', 'set_custom_edit_organization_columns' );
  10. function set_custom_edit_organization_columns($columns) {
  11.  
  12. $columns['profile_updated_on'] = __( 'Last Updated', 'cthe' );
  13. return $columns;
  14. }
  15.  
  16. // Add the data to the custom columns for the organization post type:
  17. add_action( 'manage_organization_posts_custom_column' , 'custom_organization_column', 10, 2 );
  18. function custom_organization_column( $column_name, $post_id ) {
  19.  
  20. if('profile_updated_on' != $column_name)
  21. return;
  22.  
  23. $profile_updated_on_timestamp = get_post_meta( $post_id , 'profile_updated_on' , true );
  24.  
  25. //echo date_i18n($profile_updated_on);
  26. echo get_date_from_gmt( date( 'Y-m-d ', $profile_updated_on_timestamp ), 'F j, Y' );
  27. }
  28.  
  29. function your_columns_head($defaults) {
  30.  
  31. $new = array();
  32. $updated_by = $defaults['profile_updated_on']; // save the tags column
  33.  
  34.  
  35. foreach($defaults as $key=>$value) {
  36. if($key=='date') { // when we find the date column
  37. $new['profile_updated_on'] = $updated_by; // put the tags column before it
  38. }
  39. $new[$key]=$value;
  40. }
  41. return $new;
  42.  
  43. }
  44. add_filter('manage_organization_posts_columns', 'your_columns_head');
  45.  
  46.  
  47. function set_custom_organization_sortable_columns( $columns ) {
  48. $columns['profile_updated_on'] = 'profile_updated_on';
  49.  
  50. //To make a column 'un-sortable' remove it from the array
  51. //unset($columns['title']);
  52.  
  53. return $columns;
  54. }
  55. add_filter( 'manage_edit-organization_sortable_columns', 'set_custom_organization_sortable_columns' );
Add Comment
Please, Sign In to add comment