Tell us what you are trying to do?
Display the values for a checkbox custom field as bulleted list.
Is there any documentation that you are following?
I could not locate any.
Is there a similar example that we can see?
The Content Template contains the following reference to the checkbox field:
[types field='areas-of-practise'][/types]
What is the link to your site?
versteckter Link
"Areas of Practise" at bottom of page.
May need to whitelist your IPS for you to access it since this is a staging site.
Hi John,
Thank you for getting in touch.
In order to do this we will need to use a custom shortcode to parse the values and then display it as list.
Essentially what you'll be doing is taking each of the value and compiling it into an html list.
If you're familiar with how to write php code then you can use the tool below to generate the custom shortcode.
versteckter Link
If you're not comfortable at taking a go at it then i'll be more than happy to assist.
Please let me know if this help.
Thanks,
Shane
Hi Shane,
Would you be so kind as to assist in generating that shortcode?
Thanks.
John
Hi John,
Add the following to your Toolset custom code settings at Toolset->Settings->Custom Code. Once you've done this please ensure that you've activated it.
// Add Shortcode
function checkbox_list( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'list' => '',
),
$atts
);
$checklist = "<ul>";
$arrs = explode(',',$atts['list']);
foreach($arrs as $arr){
$checklist .= '<li>'.$arr.'</li>';
}
$checklist .="</ul>";
return $checklist;
}
add_shortcode( 'checkbox_list', 'checkbox_list' );
Here is an example usage.
[checkbox_list list="[types field='areas-of-practise'][/types]"]
Please let me know if this helps.
Thanks,
Shane
Thanks Shane,
And just to confirm ... this will output the checkbox list selections/values (The ones we assign when editing a record in Toolset).... as a ordered list when we output it to the Content Template. Correct?
John
Hi John,
That's correct.
However the display will be like bullet points instead of numbers.
Is it that you wanted them to be listed with the position number beside them like below?
1. Value 1
2. Value 2
3. Value 3
If so then all you need to do is to change the
to
and
respectively.
Thanks,
Shane
Thanks again Shane! Great support!
My issue is resolved now. Thank you!