full code
<?php get_header();?>
<div class="main-container col2-left-layout">
<div class="main">
<div class="breadcrumbs">
<ul>
<?php require_once('breadcrumb.php');?>
</ul>
</div>
<div class="col-main">
<div class="home-products" style="margin-top:15px;">
<div class="block-title">
<strong id="abc">
<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );?>
<?php //echo get_the_term_list( $post->ID, 'nhom-hang');
echo $term->name
?>
</strong>
</div>
<?php
if(have_posts() ){
?>
<ul class="products-grid">
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
//query_posts('post_type=san-pham&posts_per_page=8&paged='.$paged);
query_posts(array(
'post_type' => 'san-pham',
'posts_per_page' => 8,
'paged' => $paged,
'order' => 'DESC',
)
);
?>
<?php $i=1; while(have_posts()) : the_post(); ?>
<?php if ($i==1)
{echo ' <li class="item first">';}
;?>
<?php if ($i==2)
{echo ' <li class="item">';}
;?>
<?php if ($i==3)
{echo ' <li class="item last">';}
;?>
<?php if ($i==4)
{echo ' <li class="item first">';}
;?>
<?php if ($i==5)
{echo ' <li class="item">';}
;?>
<?php if ($i==6)
{echo ' <li class="item last">';}
;?>
<?php if ($i==7)
{echo ' <li class="item first">';}
;?>
<?php if ($i==8)
{echo ' <li class="item">';}
;?>
<?php if ($i==9)
{echo ' <li class="item last">';}
;?>
<div class="product-box">
<a href="<?php the_permalink();?>" title="<?php the_title();?>" class="product-image">
<img src="<?php echo get_post_meta($post->ID, 'image', true); ?>" width="204" height="204" alt="<?php the_title();?>">
</a>
<h3 class="product-name"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php catchuoi_title(35); ?></a></h3>
</div>
<div class="clear"></div>
<div class="price-box">
<?php
$discount = get_post_meta(get_the_id(), 'discount',true);
$price = get_post_meta(get_the_id(), 'price',true);
?>
<?php if (!$discount) {?>
<span class="regular-price" id="product-price-1-new">
<span class="price"><?php echo get_post_meta($post->ID, 'price', true); ?></span>
</span>
<?php } ?>
<span class="regular-price" id="product-price-1-new">
<span class="price"><?php echo get_post_meta($post->ID, 'discount', true).'vnđ'; ?></span>
</span>
</div>
<div class="clear"></div>
<div class="actions">
<?php
if(function_exists('addCartButton')){
addCartButton(get_the_id(),"Giỏ hàng");
}
?>
<a class="button-view" href="<?php the_permalink();?>" title="View">Chi tiết</a>
</div>
</li>
<?php $i++; endwhile ?>
</ul>
<?php } else{ ?>
<h1>Chưa có sản phẩm!!!!!</h1>
<?php } ?>
</div>
<div style="float:right; margin-top:20px;">
<?php if (function_exists('wp_pagenavi')) {
wp_pagenavi(); } ?>
</div>
</div>
<?php get_sidebar('1');?>
</div>
<?php get_footer();?>