Hi,
any news on this matter?
https://toolset.com/forums/topic/get-all-custom-fields/
Sadly, I wasn't able to adapt the suggested workaround to our code.
Thanks. Best
Hello,
I assume we are talking about the same issue of below erratum:
https://toolset.com/errata/cannot-output-checkboxes-field-option-titles/
It is still in "Open" status, our developers are working on it, but I am not sure when will it be fixed, I can update here if there is any news.
Somehow I cannot properly integrate the workaround Nigel suggested here
https://toolset.com/forums/topic/get-all-custom-fields/#post-1901363
to my code.
I have a complex shortcode to generate various types of tables, lists etc. from all selected checkboxes.
At the beginning of this function, I collect all titles and stored values of these checkboxes. Here an extract of it:
function list_features($attr) {
$feats_table = '';
$args = shortcode_atts(array(
'type' => 'text', // text (only text comma delimited), table (text and icons)
'slug' => '', // slug of the CPT
'separator' => ','
), $attr );
// get comma-separated strings of the raw values and titles of each checked checkbox
$id = get_the_ID(); // post id
$feats_raw = types_render_field( $args['slug'], array('item' => $id, 'output' => 'raw', 'separator' => ','));
$feats_titles = types_render_field( $args['slug'], array('item' => $id, 'output' => 'normal', 'separator' => $args['separator']));
Because of the Toolset bug, the variable $feats_titles get the stored value, instead of the checkbox title.
Following Nigel's suggestion I would have to apply a "do_shortcode" in this shortcode, which I think is not an elegant solution.
Any idea is really appreciated. Thanks
Hi,
Thanks for writing back.
Luo is on vacation, so I'll be following up on this ticket.
I can't think of any drawback of using the "do_shortcode" in the custom code context that you've shared and it also worked when I tested this on my website:
$feats_titles = do_shortcode("[checkboxes field='post-checkboxes' separator=',']");
Note: you'll replace "post-checkboxes" with your actual checkboxes type custom field slug.
Can you please test it and let me know how it goes?
regards,
Waqar
My issue is resolved now. Thank you!