Created
May 8, 2018 17:21
-
-
Save djrmom/17cc98228006797d7ddad22f10b2279a to your computer and use it in GitHub Desktop.
facetwp replace display values in index
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 | |
| /** simple example of replacing values with new values in index | |
| ** rememember to reindex after adding code | |
| **/ | |
| add_filter( 'facetwp_index_row', function( $params ) { | |
| if ( 'post_type' == $params['facet_name'] ) { // 'post_type' should be replaced with your facet name | |
| $current_values = array( 'Posts', 'Products' ); // array of values currently being used that you want to replace | |
| $replace_values = array( 'Articles', 'For Sale' ); // array of values to replace with, values are in same order as above | |
| $params['facet_display_value'] = str_replace( $current_values, $replace_values, $params['facet_display_value'] ); | |
| } | |
| return $params; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment