@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * @access private |
| 30 | 30 | */ |
| 31 | 31 | public function __construct() { |
| 32 | - add_filter( 'manage_tour_posts_columns', array( $this, 'register_tour_columns' ) ); |
|
| 33 | - add_action( 'manage_tour_posts_custom_column', array( $this, 'output_tour_ref_column' ), 10, 2 ); |
|
| 32 | + add_filter('manage_tour_posts_columns', array($this, 'register_tour_columns')); |
|
| 33 | + add_action('manage_tour_posts_custom_column', array($this, 'output_tour_ref_column'), 10, 2); |
|
| 34 | 34 | |
| 35 | 35 | // Sortables Columns, sorting needs to be fixed |
| 36 | 36 | // add_filter( 'manage_edit-tour_sortable_columns', array( $this, 'register_sortable_columns' ) ); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public static function get_instance() { |
| 46 | 46 | // If the single instance hasn't been set, set it now. |
| 47 | - if ( ! isset( self::$instance ) ) { |
|
| 47 | + if (!isset(self::$instance)) { |
|
| 48 | 48 | self::$instance = new self(); |
| 49 | 49 | } |
| 50 | 50 | return self::$instance; |
@@ -63,16 +63,16 @@ discard block |
||
| 63 | 63 | * @param array $columns |
| 64 | 64 | * @return array |
| 65 | 65 | */ |
| 66 | - public function register_tour_columns( $columns ) { |
|
| 66 | + public function register_tour_columns($columns) { |
|
| 67 | 67 | $new_columns = array( |
| 68 | 68 | 'cb' => $columns['cb'], |
| 69 | 69 | 'title' => $columns['title'], |
| 70 | - 'wetu_ref' => __( 'Ref', 'lsx-wetu-importer' ), |
|
| 70 | + 'wetu_ref' => __('Ref', 'lsx-wetu-importer'), |
|
| 71 | 71 | ); |
| 72 | - unset( $columns['cb'] ); |
|
| 73 | - unset( $columns['title'] ); |
|
| 74 | - foreach ( $columns as $column_key => $column_label ) { |
|
| 75 | - $new_columns[ $column_key ] = $column_label; |
|
| 72 | + unset($columns['cb']); |
|
| 73 | + unset($columns['title']); |
|
| 74 | + foreach ($columns as $column_key => $column_label) { |
|
| 75 | + $new_columns[$column_key] = $column_label; |
|
| 76 | 76 | } |
| 77 | 77 | $columns = $new_columns; |
| 78 | 78 | return $columns; |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | * @param string $post_id |
| 86 | 86 | * @return void |
| 87 | 87 | */ |
| 88 | - public function output_tour_ref_column( $column, $post_id ) { |
|
| 89 | - if ( 'wetu_ref' === $column ) { |
|
| 90 | - echo esc_attr( get_post_meta( $post_id, 'lsx_wetu_ref', true ) ); |
|
| 88 | + public function output_tour_ref_column($column, $post_id) { |
|
| 89 | + if ('wetu_ref' === $column) { |
|
| 90 | + echo esc_attr(get_post_meta($post_id, 'lsx_wetu_ref', true)); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param array $columns |
| 98 | 98 | * @return array |
| 99 | 99 | */ |
| 100 | - public function register_sortable_columns( $columns = array() ) { |
|
| 100 | + public function register_sortable_columns($columns = array()) { |
|
| 101 | 101 | $columns['wetu_ref'] = 'price_per_month'; |
| 102 | 102 | return $columns; |
| 103 | 103 | } |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | * @param object $query WP_Query() |
| 109 | 109 | * @return void |
| 110 | 110 | */ |
| 111 | - public function columns_posts_orderby( $query ) { |
|
| 112 | - if( ! is_admin() || ! $query->is_main_query() ) { |
|
| 111 | + public function columns_posts_orderby($query) { |
|
| 112 | + if (!is_admin() || !$query->is_main_query()) { |
|
| 113 | 113 | return; |
| 114 | 114 | } |
| 115 | - if ( 'wetu_ref' === $query->get( 'orderby' ) ) { |
|
| 116 | - $query->set( 'orderby', 'meta_value' ); |
|
| 117 | - $query->set( 'meta_key', 'lsx_wetu_reference' ); |
|
| 115 | + if ('wetu_ref' === $query->get('orderby')) { |
|
| 116 | + $query->set('orderby', 'meta_value'); |
|
| 117 | + $query->set('meta_key', 'lsx_wetu_reference'); |
|
| 118 | 118 | } |
| 119 | 119 | /*if ( $query->is_search() && 'tour' === $query->get( 'post_type' ) ) { |
| 120 | 120 | $meta_query = array( |