Hi, there is an elegant way to collect all data from all available Toolset custom fields of a certain CPT?
This issue is now escalated to the developers. I'll keep you informed as soon as we have a fix or a workaround.
Hi, any news on this matter?
I have a website in stand-by waiting for this solution 🙁
Thanks
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
Hi there
Jamal is off today. We don't have a solution from the developers yet, but I crafted a workaround you can use or adapt as required.
The following registers a shortcode 'checkboxes' that will (correctly) output the checked option titles for the current post:
add_shortcode( 'checkboxes', function( $atts = [] ){
// provide defaults
$atts = shortcode_atts(
array(
'field'=> 'null',
'separator' => ', '
),
$atts
);
$output = "";
global $post;
$field_settings = types_get_field( $atts['field'] );
$field_values = get_post_meta( $post->ID, 'wpcf-'.$atts['field'], false );
$field_value_options = array_keys( $field_values[0] );
$separator = "";
foreach ($field_value_options as $field_value_option) {
$field_value_option_title = $field_settings['data']['options'][$field_value_option]['title'];
$output .= $separator . $field_value_option_title;
$separator = $atts['separator'];
}
return $output;
});
You need to pass the checkboxes field slug, and can optionally pass a separator string (which otherwise defaults to ", "), like so:
[checkboxes field='checkers' separator='|']
Hello,
Can you check if the provided custom code helps you get the labels of the checkboxes field?
I'll let you know as soon as we have a fix from the developers.
Thank you.
Hi,
first of all, thanks for the custom code, I really appreciate that.
As the site is almost finished and working, I am trying to adapt it to the function I have already in place.
Still hoping the bug will be corrected in the next update.
Thanks
Thank you,
We'll keep you updated as soon as we have a fix or a patch for this issue. As of now, there is nothing we can do further, so I suggest that we mark this ticket as resolved. Feel free to open a new ticket or chat for any other request or question.
Best regards,
Jamal