Hide Gravity Forms Field Labels
If you’re like me you like simple forms and one thing I find myself doing over and over is visually hiding the labels on form fields in lieu of placeholders.
I also find myself working with Gravity Forms quite often and have always found it a bit annoying to hide the field labels. Luckily, the folks at Gravity Forms recognized this and added a nifty filter to help with hiding the labels.
Now, this filter has been around since version 1.9 and it’s typically recommended to add it to your functions.php which is simple enough, but this always kinda irks me. It’s one of those things where I think functionality is colliding with the presentation layer. I could also add it to a core plugin which is what I have done for the last 3 years. In fact, it’s in my core functions plugin template, but this doesn’t help anybody who isn’t a developer or is uncomfortable even looking at the functions.php.
So I took the bull by the horns. I fought the good fight. I walked the hard road and crawled through the dredges. I lif… well, you get the picture.
I wrote a plugin with a single line of code and submitted it to the repo.
Now, when you need to hide those pesky Gravity Forms labels just click Add New and search for “Hide Gravity Form Labels“.
https://wordpress.org/plugins/hide-gravity-form-labels/
Hi Michael,
Thanks a lot for this plugin, it really comes in handy 🙂 I use it in combination with a plugin from Surbma to automatically style it to a Divi theme form. So this saves me from adding losts of custom css for every website I make.
However I have 2 issues: it’s the margin-bottom of 12px here: .gform_wrapper .field_sublabel_hidden_label .ginput_complex.ginput_container input[type=text] and the 12px margin-top here: .gform_wrapper li.hidden_label input. These create quite a lot of white space between the name and e-mail fields and makes the form look a bit messy.
To remove these margins, I would still have to add custom css… Would it be possible to include these settings in your plugin? That would really be great :):)
Thanks for the kind remarks, Ester! I’m glad to hear that the plugin is helping you out.
At this time, I feel like adding any styles or enhancements is a bit out of scope for the plugin. It is meant to perform only a single function and that is to activate the GF filter for the hidden labels. However, I will certainly take your suggestions into consideration for any future updates.
In the nearer future, I would recommend using a core functionality plugin to enqueue some basic styles for your specific needs. This way, you could just load up your core functionality plugin on each site.