Last active
November 21, 2017 18:23
-
-
Save djrmom/a724dd3181298a69b51a304d228891be 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( 'id', $params['facet_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