Ticket #24: 24.diff
File 24.diff, 1.2 KB (added by , 10 years ago) |
---|
-
wc-post-types.php
26 26 add_action( 'save_post', array( $this, 'save_post_session' ), 10, 2 ); 27 27 add_action( 'save_post', array( $this, 'save_post_organizer' ), 10, 2); 28 28 add_action( 'save_post', array( $this, 'save_post_sponsor' ), 10, 2); 29 add_action( 'pre_get_posts', array( $this, 'sort_sessions_by_time_column' ) ); 29 30 30 31 add_filter( 'manage_wcb_speaker_posts_columns', array( $this, 'manage_post_types_columns' ) ); 31 32 add_filter( 'manage_wcb_session_posts_columns', array( $this, 'manage_post_types_columns' ) ); … … 1790 1791 } 1791 1792 1792 1793 /** 1794 * Sort sessions by time column 1795 * 1796 * @param WP_Query $query 1797 */ 1798 public function sort_sessions_by_time_column( $query ) { 1799 if ( !is_admin() || 'wcb_session' != $query->get( 'post_type' ) ) { 1800 return; 1801 } 1802 1803 $query->set( 'meta_key', '_wcpt_session_time' ); 1804 $query->set( 'orderby', '_wcpt_session_time' ); 1805 $query->set( 'order', 'asc' ); 1806 } 1807 1808 /** 1793 1809 * Display an additional post label if needed. 1794 1810 */ 1795 1811 function display_post_states( $states ) {