[Resolved] How to display field titles with icons before field values
This thread is resolved. Here is a description of the problem and solution.
Problem:
How to output text such as a title or an icon before a field in a template?
Solution:
In a template (for single posts, or the output of a View) you are simply writing markup, with Types and Views shortcodes used to output dynamic content from a post's fields, so you can precede the shortcode that outputs a field with whatever text or HTML you like, including, for example, an SVG icon.
If you only want to output these when the field has some value you can wrap the whole section in a wpv-conditional shortcode that first confirms the field as a value (see docs).
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have bought your plugin, but I'm struggling with it.
I want to show product attributes (custom fields) on the product page in a nice table view, just like woocommerce attributes are shown. And the same attribute as an icon on the product archive page
1. problem
I have achived that the custom field content shows up on the product page, but it doesn't show the fields name.
How it currently looks:
black
large
cotton
How I want it to show up:
Color: black
Size: large
Material: cotton
2. How can I show a custom field (text) as an image/icon on the product archive page?
I want to link an icon to a text field.
When you edit a template you are editing the markup that will be output on the page, so if you insert a custom field using a types shortcode you can simply precede the field value with whatever text you want, e.g.
I'm not sure what you mean by your second question.
According to your settings at Toolset > Settings > Custom Content you can save HTML in your custom fields, so you could directly save an svg tag with an icon in a text field for example which would render as an icon on the front end.
Or, if you just mean you want to show an icon before the text of a custom field then you can just simply add it to the markup, like above. Precisely how will depend on what icon solutions you have available to you (your theme may make icons available on the front end, or you could insert an svg tag with an icon, for example).
If I have misunderstood, please clarify what you need.
Is there a way I can show all the custom fields that belong to a Post Field Group with just one shortcode?
If I use the solution you suggested, it would for example show:
color:
size: L
It would show color without any value if I didn't choose one for the product.
What I mean by that is, that I only want to show the custom fields and it's titles, if I choose a value for this product.
For some of the products, I choose all values, and for other, I only choose some selected ones, and I don't want to show empty field titles without any values on the frontend.
Regarding my 2nd question:
I have a field called color. On the product page I want to show word color in text format, and on the product archive page I want to show a red little icon using the same custom field. I don't want to create 2 seperate fields one for the product and one for the product archive page.
How is that possible?
Never mind I'm slowly getting the hang of it.
Now I have a different problem.
Since I#m using toolset, the settings page of WPML is blanked out and I can't use the string translation tool.
What could cause the problem?
New threads created by Nigel and linked to this one are listed below: