$term = get_queried_object();
global $wpdb;
$results = $wpdb->get_col("
SELECT pm.meta_value
FROM {$wpdb->prefix}term_relationships as tr
INNER JOIN {$wpdb->prefix}term_taxonomy as tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
INNER JOIN {$wpdb->prefix}terms as t ON tr.term_taxonomy_id = t.term_id
INNER JOIN {$wpdb->prefix}postmeta as pm ON tr.object_id = pm.post_id
WHERE tt.taxonomy LIKE 'product_cat'
AND t.term_id = {$term->term_id}
AND pm.meta_key = '_price'
");
sort($results, SORT_NUMERIC);
function non_zero($a){ // игнорим пустые и 0 значения
return($a > 0);
}
$min_cat_price = min(array_filter($results, 'non_zero'));
echo 'от ' . $min_cat_price . ' руб.';
add_image_size( 'new-size', 450, 450, true );
the_post_thumbnail('new-size');