Last active
November 12, 2021 16:21
-
-
Save ronalfy/e7963b5405bccbe2ed3937588335fc85 to your computer and use it in GitHub Desktop.
Paid Memberships Pro Directory Sort by Last Name and First Name
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
<?php | |
/** | |
* Sort the membership directory by lastname first, then first name. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_custom_directory_sql_parts( $parts ) { | |
$parts['ORDER'] = ' ORDER BY last_name,first_name ASC '; | |
return $parts; | |
} | |
add_filter( 'pmpro_member_directory_sql_parts', 'pmpro_custom_directory_sql_parts', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I use this but use member number instead of first and last name?