From e10bf9004bd18d1181231c8cecd42e43d5c80eca Mon Sep 17 00:00:00 2001 From: Fredrik Forsmo Date: Thu, 4 Jun 2015 13:33:56 +0200 Subject: [PATCH] Changed to a mutch cleaner fix --- .../properties/class-papi-property-relationship.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/includes/properties/class-papi-property-relationship.php b/src/includes/properties/class-papi-property-relationship.php index 9c498a27e..236ec01d3 100644 --- a/src/includes/properties/class-papi-property-relationship.php +++ b/src/includes/properties/class-papi-property-relationship.php @@ -66,6 +66,8 @@ public function get_sort_option( $post_id, $slug ) { public static function get_sort_options() { $sort_options = array(); + $sort_options[__( 'Select', 'papi' )] = null; + $sort_options[__( 'Name (alphabetically)', 'papi' )] = function ( $a, $b ) { return strcmp( strtolower( $a->post_title ), strtolower( $b->post_title ) ); }; @@ -150,11 +152,7 @@ public function html() { show_sort_by ): ?> @@ -215,7 +213,7 @@ public function sort_value( $value, $slug, $post_id ) { $sort_option = $this->get_sort_option( $post_id, $slug ); $sort_options = static::get_sort_options(); - if ( empty( $sort_option ) || ! isset( $sort_options[$sort_option] ) ) { + if ( empty( $sort_option ) || ! isset( $sort_options[$sort_option] ) || is_null( $sort_options[$sort_option] ) ) { return $value; }