Skip Navigation

[Resolved] How do I display *just* the name of a CRED field?

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#915661

Is there a shortcode that displays just the name of a field (and not the value)

I want to display some information from CRED fields on a post, but would like the names to be pulled from the database and not hardcoded (so that they update when a mod changes a field name)

Similarly, I'd like to display the descriptions of a field - is there a shortcode for that?

Thanks!

The layout is similar to this:

<li itemprop="amenityFeature" itemscope itemtype="<em><u>hidden link</u></em>">
                        <span itemprop="name">Induction Loop Available</span>:
                        <span itemprop="value">[types field='accessibility-induction-loop-available' state="checked"]Yes[/types][types field='accessibility-induction-loop-available' state="unchecked"]No[/types]</span>
                    </li>

I'd like "Induction Loop Available" to come from the CRED field and not hardcode it

#915721

Hi, the description is meant to be shown in wp-admin but not intended for use in CRED.

If you'd like to include a message next to a CRED form field, you need to create another shortcode for it, for example this thread:
https://toolset.com/forums/topic/get-custom-field-description-in-php/

#915751

Thanks, I thought that might be the case with descriptions.

Is there a way to show just the field name though?

#915754

same as above, you can get the field name setting like this:

$fields=get_option( "wpcf-fields" );
$name=$fields['my-single-line-field-slug']['name'];