add-to-cart
7 years ago
tabs
7 years ago
meta.php
7 years ago
photoswipe.php
7 years ago
price.php
7 years ago
product-attributes.php
7 years ago
product-image.php
7 years ago
product-thumbnails.php
7 years ago
rating.php
7 years ago
related.php
7 years ago
review-meta.php
8 years ago
review-rating.php
7 years ago
review.php
7 years ago
sale-flash.php
7 years ago
share.php
7 years ago
short-description.php
7 years ago
stock.php
7 years ago
title.php
7 years ago
up-sells.php
7 years ago
related.php
48 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Related Products |
| 4 | * |
| 5 | * This template can be overridden by copying it to yourtheme/woocommerce/single-product/related.php. |
| 6 | * |
| 7 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 8 | * (the theme developer) will need to copy the new files to your theme to |
| 9 | * maintain compatibility. We try to do this as little as possible, but it does |
| 10 | * happen. When this occurs the version of the template file will be bumped and |
| 11 | * the readme will list any important changes. |
| 12 | * |
| 13 | * @see https://docs.woocommerce.com/document/template-structure/ |
| 14 | * @package WooCommerce/Templates |
| 15 | * @version 3.0.0 |
| 16 | */ |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; |
| 20 | } |
| 21 | |
| 22 | if ( $related_products ) : ?> |
| 23 | |
| 24 | <section class="related products"> |
| 25 | |
| 26 | <h2><?php esc_html_e( 'Related products', 'woocommerce' ); ?></h2> |
| 27 | |
| 28 | <?php woocommerce_product_loop_start(); ?> |
| 29 | |
| 30 | <?php foreach ( $related_products as $related_product ) : ?> |
| 31 | |
| 32 | <?php |
| 33 | $post_object = get_post( $related_product->get_id() ); |
| 34 | |
| 35 | setup_postdata( $GLOBALS['post'] =& $post_object ); |
| 36 | |
| 37 | wc_get_template_part( 'content', 'product' ); ?> |
| 38 | |
| 39 | <?php endforeach; ?> |
| 40 | |
| 41 | <?php woocommerce_product_loop_end(); ?> |
| 42 | |
| 43 | </section> |
| 44 | |
| 45 | <?php endif; |
| 46 | |
| 47 | wp_reset_postdata(); |
| 48 |