This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//change sort order to price high to low | |
add_action( 'pre_get_posts', 'gsc_listing_price_sort_order' ); | |
function gsc_listing_price_sort_order( $query ) { | |
if( !is_admin() && is_post_type_archive( 'listing' ) ) { | |
$query->set( 'meta_key', '_listing_price_sortable' ); | |
$query->set( 'orderby', 'meta_value_num' ); | |
$query->set( 'order', 'desc' ); //list high to low |