Last active
August 29, 2015 14:10
-
-
Save zackkatz/1de30214b280bc5142aa to your computer and use it in GitHub Desktop.
GravityView - Modify Search Labels (Example Code)
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 | |
/** | |
* Plugin Name: GravityView - Modify Search Labels (Example Code) | |
* Plugin URI: http://gravityview.co | |
* Description: Modify the text of Search Bar labels | |
* Version: 1.0 | |
* Author: Katz Web Services, Inc. | |
* Author URI: http://gravityview.co | |
*/ | |
add_filter( 'gravityview_search_field_label', 'modify_gravityview_search_field_label', 10, 2 ); | |
function modify_gravityview_search_field_label( $label, $form_field ) { | |
// Return the default label name by default | |
$return = $label; | |
// Then override based on the value of the label. | |
switch ( $label ) { | |
case 'Company Name': | |
$return = 'Company'; | |
break; | |
// Add additional cases here, like: | |
case 'First Name': | |
$return = 'First'; | |
break; // Don't forget "break;" after each case | |
} | |
return $return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment