Skip Navigation

[Resolved] How to show title custom fields?

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

Problem: I would like to display the name of a custom field and the field value, conditionally, based on whether or not the field has content.

Solution: Use a conditional block to display a field conditionally based on its content. Include the field name in a paragraph or other basic text block.

Relevant Documentation:
https://toolset.com/course-lesson/using-toolset-conditional-block/

This support ticket is created 3 years, 12 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 carlosb-7 3 years, 12 months ago.

Assisted by: Christian Cox.

Author
Posts
#2039229

I need to know how to show the title of the custom fields that I include in the posts.
Also if the field is empty how to hide the title custom post.
Thanks in advance.

#2039827
field-name.png
conditional-block.png
conditions.png
single-field.png

Hello, it depends on what you mean by field title. In the field-name.png screenshot here, I am showing a custom select field. The field name, "Book single select 1", is not easily displayed on the front-end of the site using dynamic content. It's usually recommended to include this information by adding it in the template editor manually using a paragraph block or something similar.

If you want to display content in the editor conditionally based on a field value, you can use a conditional block. Add a conditional block to your template and use the conditions editor to test if the value is not empty. Anything you insert inside the conditional block will be displayed on the front-end of the site.

The screenshot conditional-block.png shows a conditional block that includes the field name and field value. The screenshot conditions.png shows how you can configure the conditional to test if a field is not empty, and the screenshot single-field.png shows how you can add a Single Field block that displays the select field value.

Let me know if I've misunderstood what you want to accomplish and I can offer more guidance.

#2040813

Many thanks. This is ok just for one field in one block. But if show some fields in the front, do we have to create a conditional block for any field? Or can we use the same condicional factor for all the fields of the same block (if the block is "Fields and Text")?

#2040971

You must create one conditional block per field, if you wish to display those fields conditionally on the front-end of the site.

#2041231

My issue is resolved now. Thank you!