PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Change Field Label Name (Specifically the Address Block)

  1. shelzmike
    Member

    I have searched the forums and found only information related to the placement of the field labels, which is not what I am looking for.

    I am using the address block field set and the Street portion of the address field has a label of "Street Address". I want this to just say "Street". Where can I change that. I have looked at some of the more (what I thought were) obvious files and could not find this. Thanks!

    Mike

    Posted 11 years ago on Thursday August 4, 2011 | Permalink
  2. You can filter this text by adding some code to your functions.php:

    http://www.gravityhelp.com/documentation/page/Gform_address_street

    [EDITED quotes around filter name 8/5/11]

    For your request it would look like this:

    add_filter('gform_address_street', 'change_address_street', 10, 2);
    function change_address_street($label, $form_id){
    	return 'Street';
    }

    You'd have to do the same thing for address line 2 if you're using that line:
    http://www.gravityhelp.com/documentation/page/Gform_address_street2

    Posted 11 years ago on Thursday August 4, 2011 | Permalink
  3. shelzmike
    Member

    Great! That is exactly what I need; however, apparently I am more rusty with php than I had thought and I cannot figure out how (where) to incorporate this in the functions.php file. It seems the curly braces are throwing me off. I see in the example link you sent how to use that filter, however that example does not include the secondary portion in the braces. Thanks!

    Was trying to put it just after this at the end:

    <?php
    }
    function mytheme_wp_head() { ?>
    <?php }
    add_action('wp_head', 'mytheme_wp_head');
    add_action('admin_menu', 'mytheme_add_admin'); ?>
    Posted 11 years ago on Thursday August 4, 2011 | Permalink
  4. The curly braces should not be related. It just needs to not be nested in any other function in the file, and needs to be enclosed in php tags.

    If the file ends with a ?> then you can put it right before that, with no need for opening or closing php brackets.

    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    If you post your complete functions.php at pastie.org I can show you exactly where to put it to avoid a 500 Internal Server Error (white screen) from a syntax error.

    If that's the end of your functions.php, you can just start a new line and incorporate the code I gave you enclosed with <? php tags:

    [EDITED quotes around filter name 8/5/11]

    <?php
    add_filter('gform_address_street', 'change_address_street', 10, 2);
    function change_address_street($label, $form_id){
    	return 'Street';
    }
    ?>

    Be sure you do not have any blank lines at the end of functions.php when you are done. The ?> should be the last line.

    Posted 11 years ago on Thursday August 4, 2011 | Permalink
  5. shelzmike
    Member

    Yeah, what you have mentioned, I just tried and I am still getting a 500, so here is the whole thing at pastie. Thanks!

    http://pastie.org/2326579

    Posted 11 years ago on Friday August 5, 2011 | Permalink
  6. My mistake. I forgot a quote in the "add_filter" line around gform_address_street (there was no opening single quote). I edited my original posts.

    I added the code to the end of your functions.php and re-pasted it: http://pastie.org/2328426

    Worked without syntax errors for me. Sorry about the syntax error in my code.

    Posted 11 years ago on Saturday August 6, 2011 | Permalink
  7. shelzmike
    Member

    Here is an update. Your code actually does accomplish the task at hand. Additionally, the forms all work fine. However, it is causing refresh issues in the other parts of the WP admin area in the form of the lovely:

    'Warning: Cannot modify header information - headers already sent by (output started at /home/mmiller_itadmin/webapps.acsdish.com/wp-content/themes/acscorporate/functions.php:405) in /home/mmiller_itadmin/webapps.acsdish.com/wp-includes/pluggable.php on line 934

    Whenever I update a post or a page, I get this. Now, WP actually does update and post whatever I am trying to do, so this is just an annoyance really. I have verified that it is caused by this code as when I remove it, the site works fine. I have double-checked that there is no whitespace after the closing php tag.

    Here is a copy of my entire functions.php for review. Thanks.

    http://pastie.org/2467736

    Thanks!

    Posted 11 years ago on Thursday September 1, 2011 | Permalink
  8. The end of that file is sort of weird. The function mytheme_wp_head is not actually doing anything as the two actions are outside of the function. Unfortunately I cannot tell how it should be. Right now, the function mytheme_wp_head is being called, but it doesn't do anything. I can't tell if that will cause the headers already sent error. My guess is that it's just sending a warning about something.

    If you comment out 406,407,408 and 409 (the function I provided) the error will still occur. The error is coming on line 405 which is the opening <?php tag before the function. Something is either nested improperly or opened and closed improperly. Something weird is going on before this function. Any custom function you put on line 406+ would cause you to have a similar problem.

    Posted 11 years ago on Friday September 2, 2011 | Permalink
  9. shelzmike
    Member

    Hmm, that is strange. Well, for now I will just deal with it (i can comment out the whole thing when working, then just put it back) as it does not cause any other weird issues. Thanks!

    Mike

    Posted 11 years ago on Friday September 2, 2011 | Permalink

This topic has been resolved and has been closed to new replies.