array map > walk

This commit is contained in:
Mike Jolley 2012-02-06 16:49:18 +00:00
parent 0f736bc6e9
commit 799e353183
1 changed files with 8 additions and 8 deletions

View File

@ -131,26 +131,26 @@ function woocommerce_products($atts){
'order' => $order,
'meta_query' => array(
array(
'key' => '_visibility',
'value' => array('catalog', 'visible'),
'compare' => 'IN'
'key' => '_visibility',
'value' => array('catalog', 'visible'),
'compare' => 'IN'
)
)
);
if(isset($atts['skus'])){
$skus = explode(',', $atts['skus']);
array_walk($skus, create_function('&$val', '$val = trim($val);'));
$skus = array_map('trim', $skus);
$args['meta_query'][] = array(
'key' => '_sku',
'value' => $skus,
'compare' => 'IN'
'key' => '_sku',
'value' => $skus,
'compare' => 'IN'
);
}
if(isset($atts['ids'])){
$ids = explode(',', $atts['ids']);
array_walk($ids, create_function('&$val', '$val = trim($val);'));
$ids = array_map('trim', $ids);
$args['post__in'] = $ids;
}