柒比贰美化-首页商城调用

首页商品调用,给有需要的朋友!

柒比贰美化-首页商城调用

 

[content_hide]

[hidecontent type="payshow"]//首页商品 
if ( ! function_exists( 'home_shop_7b2' ) ) { 
    function home_shop_7b2(){ 
        if(!zrz_get_display_settings('shop_show') || !zrz_get_display_settings('shop_show_index')) return; 
            $args = apply_filters( 'home_shop_7b2_args',array( 
                'orderby' => 'date', 
                'order' => 'DESC', 
                'posts_per_page' =>4, 
                'post_type'=>'shop', 
                'meta_key' => 'zrz_shop_type', 
                'meta_value' => 'normal', 
            )); 
            $the_query = new WP_Query($args); 
            if ( $the_query->have_posts() ) { 
                echo '
'; 
                while ( $the_query->have_posts() ) { 
                    $the_query->the_post(); 
                        $post_id = get_the_id(); 
                        $price = zrz_get_shop_price_dom($post_id); 
                        $remaining = zrz_shop_count_remaining($post_id); 
                        $remaining = $remaining > 0 ? true : false; 
                        $views = get_post_meta($post_id,'views',true); 
                        $views = $views ? $views : 0; 
                        $open_new = zrz_open_new(); 
                        $thumb = zrz_get_post_thumb(zrz_get_post_thumb(),300,200); 

                        echo ' 
                                
 '.$price['msg'].' 
                                     
                                        
 
                                             
                                        
 
                                     
                                    
 
                                        
' . get_the_title() . '
 
                                        
 
                                            
 '.$price['dom'].' 
 
                                            
 '.($remaining ? '购买' : '售罄').' 
 
                                        
 
                                        
 
                                            
 
                                                总数:'.zrz_get_shop_count($post_id,'total').' 
                                                已售:'.zrz_get_shop_count($post_id,'sell').' 
                                            
 
                                            
 人气:'.$views.' 
 
                                        
 
                                    
 
                                
 
                            '; 
                } 
                echo '
';
                wp_reset_postdata(); 
            } else { 
                echo '
没有商品!
'; 
        } 
    } 
} 

[/hidecontent][/content_hide]