Merge pull request #25059 from R33D3M33R/patch-1

Allow related title changes
This commit is contained in:
Gerhard Potgieter 2019-12-06 15:20:57 +02:00 committed by GitHub
commit e300bc47b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 10 deletions

View File

@ -12,7 +12,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.0.0
* @version 3.9.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -23,7 +23,13 @@ if ( $related_products ) : ?>
<section class="related products">
<h2><?php esc_html_e( 'Related products', 'woocommerce' ); ?></h2>
<?php
$heading = apply_filters( 'woocommerce_product_related_products_heading', __( 'Related products', 'woocommerce' ) );
if ( $heading ) :
?>
<h2><?php echo esc_html( $heading ); ?></h2>
<?php endif; ?>
<?php woocommerce_product_loop_start(); ?>
@ -32,16 +38,17 @@ if ( $related_products ) : ?>
<?php
$post_object = get_post( $related_product->get_id() );
setup_postdata( $GLOBALS['post'] =& $post_object );
setup_postdata( $GLOBALS['post'] =& $post_object ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited, Squiz.PHP.DisallowMultipleAssignments.Found
wc_get_template_part( 'content', 'product' ); ?>
wc_get_template_part( 'content', 'product' );
?>
<?php endforeach; ?>
<?php woocommerce_product_loop_end(); ?>
</section>
<?php endif;
<?php
endif;
wp_reset_postdata();