C:\xampp\htdocs\landing\wp-content\plugins\penci-pennews-amp\templates\woocommerce\related.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
 * Related Products
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/single-product/related.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see        https://docs.woocommerce.com/document/template-structure/
 * @author        WooThemes
 * @package    WooCommerce/Templates
 * @version     3.0.0
 */

if ( ! defined'ABSPATH' ) ) {
    exit;
}

global 
$product$woocommerce_loop;

if ( ! 
$product ) {
    return;
}

$args = array(
    
'post_type'      => 'product',
    
'posts_per_page' => 2,
    
'orderby'        => 'rand',
    
'order'          => 'desc',
);

$related_query            = new WP_Query$args );
if ( 
$related_query->have_posts() ) :
    
$product_i 0;

    echo 
'<div class="penci-post-related products">';
    echo 
'<div class="post-title-box"><h4 class="post-box-title">' penci_amp_get_setting'penci_amp_related_product' ) . '</h4></div>';
    echo 
'<div class="penci-archive__list_product">';
    while ( 
$related_query->have_posts() ) : $related_query->the_post();
        
$product_i ++; ?>
        <?php
        
global $post$product;
        
?>
        <article <?php post_class'penci-product-item penci-product-item-' $product_i ); ?>>
            <div class="article_content">
                <?php
                
if ( $product->is_on_sale() ) {
                    echo 
apply_filters(
                        
'woocommerce_sale_flash',
                        
'<span class="onsale">' penci_amp_get_setting'penci-amp-product-sale' ) . '</span>',
                        
$post,
                        
$product
                    
);
                }

                
?>
                <?php
                
if ( get_option'woocommerce_enable_review_rating' ) !== 'no' ) {
                    echo 
wc_get_rating_html$product->get_average_rating() );
                }
                
?>
                <div class="entry-media">
                    <a class="penci-link-post" href="<?php the_permalink(); ?>"><?php penci_amp_post_thumbnail( array( 'post' => get_the_ID(), 'size' => 'shop_catalog' ) ); ?></a>
                </div>
                <div class="entry-text">
                    <h3 class="penci__product__title">
                        <a href="<?php the_permalink() ?>" title="<?php the_title_attribute() ?>">
                            <?php the_title() ?>
                        </a>
                    </h3>

                    <div class="woocommerce-price"><?php echo $product->get_price_html(); ?></div>
                </div>
            </div>
        </article>
        <?php
    
endwhile;
    echo 
'</div>';
    echo 
'</div>';
endif;
wp_reset_postdata();
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586