$result->get_col($sql);
$minPrice = min($result);
$maxPrice = max($result);
SELECT
MinPricesQuery.MinPrice
FROM
`wp_posts`
INNER JOIN `wp_term_relationships` ON (
`wp_posts`.ID = `wp_term_relationships`.object_id
)
INNER JOIN (
SELECT
Id, MIN(Price)
FROM
(
SELECT
`post_id` AS Id,
`meta_value` AS Price
FROM
`wp_postmeta`
WHERE
`meta_key` = '_price'
AND `post_id` IN (
SELECT
`post_id`
FROM
`wp_postmeta`
WHERE
`meta_key` = 'convert_to_rub'
AND `meta_value` = 0
)
UNION
SELECT
`post_id` AS Id,
`meta_value` * 80 AS Price
FROM
`wp_postmeta`
WHERE
`meta_key` = '_price'
AND `post_id` IN (
SELECT
`post_id`
FROM
`wp_postmeta`
WHERE
`meta_key` = 'convert_to_rub'
AND `meta_value` = 1
)
) AS P
GROUP BY Id
) MinPricesQuery ON (`wp_posts`.ID = MinPricesQuery.Id)
WHERE
(`wp_term_relationships`.term_taxonomy_id = 619)
AND
(`wp_posts`.post_type = 'product')
SELECT meta_value as min_price
FROM wp_posts
INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)
WHERE
( wp_term_relationships.term_taxonomy_id IN (%d) )
AND wp_posts.post_type = 'product'
AND wp_postmeta.meta_key = '_price'
HAVING MIN( wp_postmeta.meta_value )
add_action( 'edited_term', 'update_prices_in_products', 10, 3 );
function update_prices_in_products( $term_id, $tt_id, $taxonomy ) {
$price = get_post_meta( $product_id, '_regular_price', true );
update_post_meta( $product_id, '_euro_price', $price );
update_post_meta( $product_id, '_price', $price*get_eur_multiplier() );
}
Это я сделаю, тут вопросов нет. Я верстаю с помощью GULP, у меня это все настроено.
На счет логики WP спасибо, буду изучать.
А под мобильные устройства имеет смысл поделить стили?