Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2. // Edit admin columns
  3. function my_page_columns($columns) {
  4. $columns = array(
  5. 'cb' => '<input type="checkbox" />',
  6. 'title' => 'Title',
  7. 'publish' => 'Publish date',
  8. 'expire' => 'Expire date',
  9. 'date' => 'Date',
  10. );
  11. return $columns;
  12. }
  13.  
  14. function my_custom_columns($column) {
  15. global $post;
  16. if($column == 'publish') {
  17.  
  18. if(get_field('publish_date')) {
  19. echo get_field('publish_date');
  20. }
  21.  
  22. } elseif($column == 'expire') {
  23.  
  24. if(get_field('expire_date')) {
  25. echo get_field('expire_date');
  26. }
  27.  
  28. }
  29. }
  30. function my_column_register_sortable( $columns )
  31. {
  32. $columns['publish'] = 'publish';
  33. $columns['expire'] = 'expire';
  34. return $columns;
  35. }
  36.  
  37. add_filter('manage_edit-webinar_sortable_columns', __NAMESPACE__ . '\\my_column_register_sortable' );
  38. add_action('manage_webinar_posts_custom_column', __NAMESPACE__ . '\\my_custom_columns');
  39. add_filter('manage_webinar_posts_columns', __NAMESPACE__ . '\\my_page_columns');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement