That linked thread covers a few aspects of a problem, what exactly is it that you need to be able to do.
If you are outputting a Types field using a shortcode you can just preface the field with a hard-coded label using strong tags or some CSS styling.
Can you clarify where and how you are outputting the field? (If you were using the block editor, for example, you'd need a different approach when using the Single Field block to output the field value.)
I'm using the following shortcodes for example:
[types field='address' show_name='true'][/types]
[types field='phone' show_name='true'][/types]
[types field='email' show_name='true'][/types]
I need to bold some of the labels (i.e. "Address", "Phone" etc.) but looking at the source code, it's not possible to isolate the label field with CSS since the label and field text are both surrounded by one <p> tag. I didn't find a way to do this via block editor, to dynamically generate the labels with the field text.
Hello there! If you don't mind, I'll continue with you on this ticket. What about adding a the labels manually, and hiding it from the shortcode. Something like:
I don't want to do it that way because if a field is empty, I don't want the label to show up. So, the labels need to be dynamically generated with the field value.
Unfortunately, that's the only way to have more control over the generated markup. You can wrap it inside conditional shortcodes to only display it when the field has a value.
Thanks but it doesn't seem to be working, the word Address shows up even when there is no address and the closing shortcode tag is also appearing [/wpv–conditional]. See this page as an example: hidden link
I'm using the code you provided:
[wpv-conditional if=(( $(wpcf-address) ne ''))] Address:
[types field='address'][/types]
[/wpv–conditional]
I would say, there is a copy/paste issue. Otherwise, the closing shortcode [/wpv–conditional] would not appear on the frontend.
Can I log in to your website and check this further? Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **