Up to 50 percent off

Hide meta fields that are not filled

This topic contains 8 reply and 3 voices, and was last updated by David 10 years, 9 months ago
Viewing 8 Posts - 1 through 8 (of 8 total)
Author Posts
November 18, 2013 at 4:43 pm 10231
David Hi, Is there any way to hide meta fields that are not filled in when a user submits a form? I have checked the "Show custom fields on post content area" checkbox in the settings menu, so I have not added any code to template files. Thanks Ingrid
November 19, 2013 at 7:05 pm 10261
Ingrid Ingrid

Hi,

did you get a chance to look at this?

November 19, 2013 at 7:26 pm 10262
Tareq Hasan Tareq Hasan

Sorry for the delay.

There is no way you can do this without changing a line in the plugin. For this, open wpuf-functions.php and in line 660, you’ll see something like this: [php]$html .= sprintf( ‘<li><label>%s</label>: %s</li>’, $attr[‘label’], make_clickable( implode( ‘, ‘, $value ) ) );[/php]

Replace this with this:
[php]
if ( $value[0] ) {
$html .= sprintf( ‘<li><label>%s</label>: %s</li>’, $attr[‘label’], make_clickable( implode( ‘, ‘, $value ) ) );
}
[/php]

It should work.

November 19, 2013 at 8:18 pm 10265
Ingrid Ingrid

Hi Tareq,

Thanks for your answer.
I applied the suggested change, but it doesn’t work.
Do you have another suggestion?

November 19, 2013 at 11:50 pm 10273
Tareq Hasan Tareq Hasan

I am not sure how did you added or modified that code. If it was right, that should work.

November 20, 2013 at 8:30 am 10285
Ingrid Ingrid

I added the code just like you said. In wpuf-functions.php
Is it possible i give you acces to my site so you can see for yourself?

November 24, 2013 at 10:40 am 12729
Tareq Hasan Tareq Hasan

Hi, sorry for the delay. Feel free to give your site details in a private reply.

November 28, 2013 at 9:53 pm 12999
Ingrid Ingrid

Hi, I already fixed it.
Thanks for your help!

February 4, 2014 at 1:25 am 15049
David David

Hi Ingrid, how did you hide the fields if no value if inserted I tried to do what Tareq with wpuf-functions.php but is still not hiding the field if no value is inserted.

Viewing 8 Posts - 1 through 8 (of 8 total)