[Resolved] Arguments in types_render_field() are ignored since Types v3.x
This thread is resolved. Here is a description of the problem and solution.
Problem:
Types 3 included a rewrite of the types_render_field function (part of the Types API which also underpins the types shortcode) and some of the arguments which used to work no longer do.
Solution:
This was unintended. After several tries to catch edge cases the existing arguments should continue to work as before in Types 3.0.6+
This support ticket is created 6 years, 5 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.
Since Version 3.x the arguments are ignored. The wrapping HTML Tags for field name and field value are missing. The functions just outputs the raw value. See the screenshots.
it works in Types 2.3.2. I use a simple text field here. See another screenshot.
For the code in my theme and a screenshot of the output see my first post in this thread.
You are right, I checked and it works pre-Types 3.
However, it is not documented, but in any case I'm escalating this so that the developers can take a look and see why it stopped working with the changes in Types 3.
Note that as a workaround you can, of course, simply insert text ahead of the field value directly in the PHP template.
I've also tried using the "output"=> "html" parameter, as this was supposed to add the field label. This doesn't seem to work either.
I've spend a while looking at the source code, and I notice that types_render_field has internally been replaced with types_render_postmeta which doesn't have the same functionality.
Our devs revisited this, and whereas the show_name attribute was available somewhat arbitrarily on some types of custom fields but not others, it has now been updated to work on all fields where it makes sense.
We released Types 3.0.6 yesterday with this fix. Please update and let me know if you still have problems with it.
The field name is back but unfortunately, it's not wrapped in a <span>-Tag as in version 2.3.2. Please see the screenshot in my 1st post in this thread: hidden link
The HTML tags looked like this in all version < 3.x:
They took another look at this and the show_name attribute should work correctly when used in combination with output="html" in the next version of Types.