Add this:
glsr_log()->debug(get_post_meta($postId, 'biz-pay-cash', true));
Then paste here what it shows in the plugin “Tools > Console” page (then remove the line).
Something like this should work:
$checkboxMetaKeys = [
'biz-pay-cash',
'biz-pay-check',
'biz-pay-credit',
'biz-pay-invoice',
'biz-pay-paypal',
];
$paymentAcceptedValues = [];
foreach ($checkboxMetaKeys as $metaKey) {
// get the meta value
$value = get_post_meta($postId, $metaKey, true);
// make sure we are dealing with an array
if (!is_array($value)) {
$paymentAcceptedValues[] = $value;
continue;
}
// remove any keys that do not have "true" as the value
$values = array_filter($value, 'wp_validate_boolean');
// create a new array with only the array keys as values
$values = array_keys($values);
// merge these values with the others
$paymentAcceptedValues = array_merge($paymentAcceptedValues, $values);
}
$schema['paymentAccepted'] = implode(', ', array_unique($paymentAcceptedValues));
Of course, you could also do this:
if (function_exists('jet_engine_custom_cb_render_checkbox')) {
$paymentAcceptedValues = array_filter([
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-cash'),
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-check'),
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-credit'),
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-invoice'),
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-paypal'),
]);
$schema['paymentAccepted'] = implode(', ', $paymentAcceptedValues);
}
…unless the meta_key is actually biz-pay for all, in which case you would simply do this:
if (function_exists('jet_engine_custom_cb_render_checkbox')) {
$schema['paymentAccepted'] = jet_engine_custom_cb_render_checkbox($postId, 'biz-pay');
}
-
This reply was modified 6 years, 4 months ago by
Gemini Labs.
That worked!
if (function_exists('jet_engine_custom_cb_render_checkbox')) {
$paymentAcceptedValues = array_filter([
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-cash'),
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-check'),
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-credit'),
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-invoice'),
jet_engine_custom_cb_render_checkbox($postId, 'biz-pay-paypal'),
]);
$schema['paymentAccepted'] = implode(', ', $paymentAcceptedValues);
}
Thanks so much. I left you a review here:
https://wordpress.org/support/topic/amazingly-perfect-plugin-and-support
Going to send some soda money too!
Thanks again!
Thanks! Happy we figured it out.