Update order by

This commit is contained in:
Hoang Huu 2019-10-31 12:20:32 +07:00
parent 5af63726c3
commit 934e0e87f0
2 changed files with 7 additions and 8 deletions

View File

@ -207,10 +207,10 @@ class Opalestate_Property {
}
/**
*
* Is featured?
*/
public function is_featured() {
return 'on' === $this->featured;
return ( 'on' === $this->featured ) || ( 1 == $this->featured );
}
/**
@ -315,7 +315,7 @@ class Opalestate_Property {
}
/**
*
* Get location.
*/
public function get_locations() {
$terms = wp_get_post_terms( $this->post_id, 'opalestate_location' );
@ -515,7 +515,7 @@ class Opalestate_Property {
* @access public
* @param $key
* @param $single
* @return string
* @return string|array
*/
public function get_metabox_value( $key, $single = true ) {
return get_post_meta( $this->post_id, OPALESTATE_PROPERTY_PREFIX . $key, $single );
@ -579,7 +579,7 @@ class Opalestate_Property {
* @return array
*/
public function get_gallery() {
return $this->get_metabox_value( 'gallery', true );
return $this->get_metabox_value( 'gallery' );
}
/**
@ -677,7 +677,6 @@ class Opalestate_Property {
return $this->get_metabox_value( 'attachments' );
}
public function get_content_single_layout() {
return $this->get_metabox_value( 'layout' );
}

View File

@ -243,11 +243,11 @@ class OpalEstate_Search {
if ( ! empty( $ksearchs ) && count( $ksearchs ) == 2 ) {
$args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . $ksearchs[0];
$args['orderby'] = 'meta_value_num';
$args['orderby'] = 'meta_value';
$args['order'] = $ksearchs[1];
} elseif ( 'on' == opalestate_options( 'show_featured_first', 'off' ) ) {
$args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . 'featured';
$args['orderby'] = 'meta_value_num';
$args['orderby'] = 'meta_value';
$args['order'] = 'DESC';
}