Skip Navigation

[Fermé] How to display the fieldname before the output of the value?

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 3 réponses, has 2 voix.

Last updated by Dido Il y a 9 années et 3 mois.

Assigned support staff: Caridad.

Auteur
Publications
#12858

Another question. On hidden link I want the fieldname, for example Afmetingen (I translated this yet with string translations to Dimensions), printed automaticaly. Now I have this in my archive.php:

Afmetingen <?php echo(types_render_field("afmetingen", array("arg1"=>"val1","arg2"=>"val2"))); ?>
In the cpt I filled in: 80 x 60cm

This prints out Afmetingen 80 x 60cm

This is ok, but I have 2 languages so I want this automaticaly.
what code can I use for it? Or are there more code examples than https://toolset.com/documentation/functions/ wher I can find out myself?

#12948

Dear Dido,

I assume you are using WPML, you need to wrap texts in gettext calls for the string translator to pick it up.

<?php _e('Afmetingen', 'goesart'); ?>

The second parameter, goesart, is useful for finding these strings in the string translator.

Please let me know if there is anything else that I can assist you with.

Regards.
Caridad

#12996

Sorry, buthis doesn't work. I looked at WPML FAQ and found out this example:

<?php _e('Afmetingen','theme-text-domain') ?>

A text-domain tells GetText (and WPML) what the text belongs to. It’s a string that doesn’t mean anything, except to you. You can choose any string that you like, but you should be consistent. The text-domain value will group related strings together.

Obviously, ‘theme-text-domain’ is not a good and unique name. For instance, if you’ve called your theme ‘star-geeks’, that would be a better value for the text-domain.

Well, the name of my theme is liquorice.

but this is not working either:
<?php _e('Afmetingen ', 'liquorice'); ?>

I moved the website to hidden link

#12997

I have found the solution, some properties on the WPML admin where not set right. I was using translation via MO-files. When I disabled this and let WPML do the translation, all was solved. Of course the MO-files should have worked too, but apparently they could not be found.

Le sujet ‘[Fermé] How to display the fieldname before the output of the value?’ est fermé à de nouvelles réponses.