Skip Navigation

[Resolved] Best way to print custom fields “names” & values considering multi-language?

This thread is resolved. Here is a description of the problem and solution.

Problem: I have several custom fields. I would like to know the best way to handle displaying their names and values, considering I will be using WPML and translating the fields.

Solution:
Use the wpml-string shortcode to register the field names for translation in String Translation. Register the fields for translation in Translation Management. Use the format "FIELD_VALUE" for the numeric field.

[wpml-string context="some-domain"]Axle:[/wpml-string] [types field="axle" format="FIELD_VALUE"][/types]<br />
[wpml-string context="some-domain"]Type:[/wpml-string] [types field="type"][/types]<br />
[wpml-string context="some-domain"]Brand:[/wpml-string] [types field="brand"][/types]<br />

Relevant Documentation:
https://toolset.com/documentation/translating-sites-built-with-toolset/

This support ticket is created 6 years, 7 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by jornB 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#924082
out.PNG
in.PNG

Hello,

I'm trying to print custom fields names and values (using layout>visual editor)

I tried this code:
[types field='type' format='

  • FIELD_NAME <span>FIELD_VALUE</span>
  • '][/types]
    It works perfectly for some fields, but not all!

    here is a link to the website I'm working with:
    hidden link

    Attached two images that reflect input/output.

    #924254

    Hi, what custom field types are these? Can you take screenshots showing me their options and values in the Custom Field editor screen?

    #948261
    co.PNG
    cf.PNG

    Here you go..

    #948495

    If you want to translate the field names, I would include the field name for translation with a wpml-string shortcode and a string, like this:

    [wpml-string context="some-domain"]Axle:[/wpml-string] [types field="axle" format="FIELD_VALUE"][/types]<br />
    [wpml-string context="some-domain"]Type:[/wpml-string] [types field="type"][/types]<br />
    [wpml-string context="some-domain"]Brand:[/wpml-string] [types field="brand"][/types]<br />
    

    Use the FIELD_VALUE format for the number field, but the other fields should be fine without a format attribute.

    #951186

    Thanks