Untitled
unknown
plain_text
a year ago
1.7 kB
4
Indexable
add_filter('b2bking_rule_column_display_who', function($return, $post_id){ $who = get_post_meta( $post_id , 'b2bking_rule_who' , true ); if ($who !== '' && $who !==NULL){ $who = explode ('_',$who); if ($who[0] === 'multiple'){ $return = ''; $multiple = get_post_meta( $post_id, 'b2bking_rule_who_multiple_options', true); $multiple_options = explode(',', $multiple); foreach ($multiple_options as $option){ $option = trim($option); if (!empty($option)){ $option_details = explode('_', $option); if ($option_details[0] === 'user'){ $user = get_user_by('id', $option_details[1]); $return.= $user->user_login.', '; } } } $return = substr($return, 0, -2); } } return $return; }, 10, 2); add_filter('b2bking_rule_column_display_applies', function($return, $post_id){ $who = get_post_meta( $post_id , 'b2bking_rule_applies' , true ); if ($who !== '' && $who !==NULL){ $who = explode ('_',$who); if ($who[0] === 'multiple'){ $return = ''; $multiple = get_post_meta( $post_id, 'b2bking_rule_applies_multiple_options', true); $multiple_options = explode(',', $multiple); foreach ($multiple_options as $option){ $option = trim($option); if (!empty($option)){ $option_details = explode('_', $option); if ($option_details[0] === 'product'){ $product_title = get_the_title($option_details[1]); $return.= $product_title.', '; } } } $return = substr($return, 0, -2); } } return $return; }, 10, 2);
Editor is loading...
Leave a Comment