Skip Navigation

[Resolved] Display checkboxes as unordered list

This support ticket is created 4 years, 9 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 replies, has 2 voices.

Last updated by Beda 4 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#1599831

Hi Toolset team,

I am trying to display the selected checkboxes options as an unordered list, instead of a text list divided by commas.

Is this possible? I checked the documentation and forums but could not find out how to achieve that.

I also read that the checkboxes custom field is still 'old code'. Could that lead to any troubles or incompatibilities later, e.g. when the current checkboxes is replaced by one built with with new code? I am just checking, because in that case I may go for another interim solution.

Many thanks,
Alex

#1600399

You could use a Single Field Block, then in the Inspector's Field Settings choose "Raw values" as output mode, and insert opening a closing List tags to the separator
The problem is you wouldn't be able to open (the first li tag) and close (the last li tag) the list tags, since the Blocks do not allow for this, and hence, it's not possible to display a checkboxes field like that in blocks with just settings

You'd have to use the ShortCode, for example, in a Text and Fields Bock, and wrap the ShortCode in a li (open and close tags), and then also use closing and opening tags in the separator attribute of the ShortCode.

I've added the ability to WRAP as a feature request so this can be considered in future.

Please let me know if you need help with the ShortCode using separators

#1600501

Thank you, Beda!

I am glad it is possible to do this using ShortCode.

I tried this one, but that only gave 1 bullet:

<ul>[types field="included"  state="checked" seperator="<li></li>][/types]</ul>

I read through the forum solutions and documentation, but could not get it to work unfortunately.
What would be the correct way of doing this?

Many thanks for your help,
Alex

#1600523

With shortcodes, it'd be done let's say in a Text and Fields Block, like so:

<li>[types field='boxes' output='raw' separator='</li><li>'][/types]</li>

Or,

<li>[types field='boxes' separator='</li><li>'][/types]</li>

Note, this will display the value of each option
Given we open and close the list, it'll produce a bullet for each option checked.
This is best inserted in HTML editing mode of a Text and Fields Block.