Skip Navigation

[Resolved] Child post checkboxes

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by leonD-4 7 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#527161

Hi, i have create a child post and i use this code:

$child_posts = types_child_posts("dimensions");
foreach ($child_posts as $child_post) {
echo $child_post->post_title;
echo $child_post->fields['sizes'];
}

Post_titile work correct, but echo $child_post->fields['sizes']; show "Array", this is a field checkboxes with multiple value, how i can display value ?

Thankyou

#527217

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Leon,

Thank you for contacting our support forum.

The sizes field, was it created using our Types plugin ?

Also let me know what does var_dump($child_post->fields['sizes']); produces.

Please let me know.

Thanks,
Shane

#527344

Yes.
array(1) { ["wpcf-fields-checkboxes-option-51a7ee6071473e93b0739a108a42e96b-1"]=> array(1) { [0]=> string(9) "11 R 24,5" } } array(2) { ["wpcf-fields-checkboxes-option-9a01d435c313a229a48d2e800946f5fb-1"]=> array(1) { [0]=> string(9) "10.5 R 20" } ["wpcf-fields-checkboxes-option-51a7ee6071473e93b0739a108a42e96b-1"]=> array(1) { [0]=> string(9) "11 R 24,5" } }

#527447

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Leon,

Try adding this to it.

$child_post->fields['sizes'][0];

This is because the array needs to be sliced for the exact value. This should now resolve the issue.

Thanks,
Shane

#527820

Hi, thank you.
Hi have the similar problem with query:

$values = $wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'wpcf-attributi'" );

var dumo:

array(2) {
[0]=>
string(6) "a:0:{}"
[1]=>
string(212) "a:2:{s:64:"wpcf-fields-checkboxes-option-1a38bb558a59802a54ebd4b27c91431e-1";a:1:{i:0;s:14:"Attacco rapido";}s:64:"wpcf-fields-checkboxes-option-0ad0b877a16a24fc4958374f171ef112-1";a:1:{i:0;s:12:"Bordo bianco";}}"
}

i want get only value 'Attacco rapido' and 'Bordo bianco'

Very thank

The forum ‘Types Community Support’ is closed to new topics and replies.