I am trying to: output the field display name for a dropdown item
Link to a page where the issue can be seen: see attached image, site is password protected
I expected to see: "Federal Comment Letter"
Instead, I got: "Resource-type: Federal Comment Letter"
I have the render set as <?php echo types_render_field('resource-type',array( 'show_name' => 'true', 'output'=>'normal' ));?>
show_name is working exactly as I expected in outputting the field name, but "raw", "normal" and "html" have no effect on the output of "Resource-type:" which I do not want to show.
As I said: "show_name is working exactly as I expected in outputting the field name, but "raw", "normal" and "html" have no effect on the output of "Resource-type:" which I do not want to show."
The problem is not show_name. The problem is the label that is being applied to the field name.
"Resource-type:" is the problem and there appears to be no way to suppress that.
Can you please tell me what issue you are having with outputting "raw", "normal" and "html"- do you mean the field is not displaying the correct value?
This code: <?php echo types_render_field('resource-type',array( 'show_name' => 'true', 'output'=>'normal' ));?>
Outputs "Resource-type:" in front of the field name regardless of whether "output" is set to raw, normal or html. Doesn't matter. It outputs the label regardless.
Raw = "Resource-type: reg-comment-letter"
Normal = "Resource-type: Regulatory Comment Letter"
HTML = "Resource-type: Regulatory Comment Letter"
See the problem? You cannot remove the label "Resource-type: " from the output regardless of what you set for output.
The first line worked. Including show_name doesn't actually show the name, it shows the meta_key, rather than the display value associated with the meta_value. However, it shows the meta_key with capitalization and the colon. That seems to be badly explained in the documentation for types_render_field.