Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackkatz/1de30214b280bc5142aa to your computer and use it in GitHub Desktop.
Save zackkatz/1de30214b280bc5142aa to your computer and use it in GitHub Desktop.
GravityView - Modify Search Labels (Example Code)
<?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