Created
May 25, 2015 23:21
-
-
Save zackkatz/8b8f296c6f7dc99d227d to your computer and use it in GitHub Desktop.
GravityView - Sort by Address field when sorting by full address
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
<?php | |
// Modify sorting when sorting full address | |
add_filter( 'gravityview/sorting/address', 'modify_gravityview_address_sorting', 10, 3 ); | |
/** | |
* Override how to sort when sorting address | |
* | |
* @since 1.8 | |
* | |
* @param string $address_part `street`, `street2`, `city`, `state`, `zip`, or `country` (default: `city`) | |
* @param string $sort_field_id Field used for sorting | |
* @param int $form_id GF Form ID | |
*/ | |
function modify_gravityview_address_sorting( 'city', $sort_field_id, $form_id ) { | |
// Change below to any of the allowed options: street, street2, city, state, zip, country | |
return 'street'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment