Last active
December 12, 2017 18:55
-
-
Save djrmom/1ede830adaf29dfbd693783166e9b5c6 to your computer and use it in GitHub Desktop.
facetwp change author display
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 | |
// re-index your facets after adding this code | |
add_filter( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'author' == $params['facet_name'] ) { | |
$user = get_user_by( 'login', $params['facet_display_value'] ); | |
if ( false !== $user ) { | |
$params['facet_display_value'] = $user->last_name . ', ' . $user->first_name | |
} | |
} | |
return $params; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment