Skip Navigation

[Resolved] Problem with slugs and titles

This support ticket is created 3 years, 10 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 3 voices.

Last updated by Puntorosso 3 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1930581

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

#1930785

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.

#1937945

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

#1939697

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

#1940289

My issue is resolved now. Thank you!