Created
November 17, 2025 20:07
-
-
Save propertyhive/08ddb92b111414c46f0fe6e7941dda6c to your computer and use it in GitHub Desktop.
Order student search by custom _pppm field when ordering by price
This file contains hidden or 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
| add_filter( 'propertyhive_get_search_results_ordering_args', 'order_students_by_pppm' ); | |
| function order_students_by_pppm($args) | |
| { | |
| if ( | |
| ( !isset($_REQUEST['department']) && get_option( 'propertyhive_primary_department', '' ) == 'student' ) | |
| || | |
| ( isset($_REQUEST['department']) && $_REQUEST['department'] == 'student' ) | |
| ) | |
| { | |
| // if searching student properties | |
| if ( isset($args['meta_key']) && $args['meta_key'] == '_price_actual' ) | |
| { | |
| // change to _pppm field | |
| $args['meta_key'] = '_pppm'; | |
| } | |
| } | |
| return $args; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment