<?php if( have_posts()): ?>
<ul class="catalog-list-items clearfix grid">
<?php
global $wp_query;
query_posts(
array_merge(
array(
'posts_per_page' => 12,
'meta_key' => 'views',
'orderby' => 'term_order',
'hide_empty' => false,
'order' => 'asc'
),
$wp_query->query
)
);
?>
<?php while( have_posts() ): the_post();
$price = get_post_meta( $post->ID, 'price', true );
$new_price = get_post_meta( $post->ID, 'new_price', true );
$type = get_post_meta( $post->ID, 'good_type', true );
$img = wp_get_attachment_image_src(get_post_meta( $post->ID, 'img1', true ), 'list-item');
?>
<li class="tovarspec">
<a href="<?php the_permalink(); ?>">
<img style="margin-left: 24px;" src="<?php echo $img[0]; ?>">
<div class="title">
<?php the_title(); ?>
</div>
</a>
<div class="desc"><?php the_content(); ?></div><a class="dalee" href="<?php the_permalink(); ?>">... читать далее</a>
<div class="price-info">
<?php if($new_price != $price): ?>
<div style="display: block;margin-top:0px;"><div class="new-price"><?php echo $new_price; ?></div><div id="rub">руб.</div></div>
<?php if($price): ?>
<div style=" position: absolute; margin-left: 10px; margin-top: 20px;"><div class="old-price"><?php echo $price; ?></div><div id="rub2">руб.</div></div>
<?php endif; ?>
<?php else: ?>
<?php if($price): ?>
<div style="display: block;margin-top:0px;"><div class="new-price"><?php echo $price; ?></div><div id="rub">руб.</div></div>
<?php endif; ?>
<?php endif; ?>
</div>
<a class="btntovar" href="<?php the_permalink(); ?>">ПОДРОБНЕЕ</a>
</li>
<?php endwhile; ?>
</ul>
<?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>