Merge pull request #25059 from R33D3M33R/patch-1
Allow related title changes
This commit is contained in:
commit
e300bc47b4
|
@ -10,9 +10,9 @@
|
||||||
* happen. When this occurs the version of the template file will be bumped and
|
* happen. When this occurs the version of the template file will be bumped and
|
||||||
* the readme will list any important changes.
|
* the readme will list any important changes.
|
||||||
*
|
*
|
||||||
* @see https://docs.woocommerce.com/document/template-structure/
|
* @see https://docs.woocommerce.com/document/template-structure/
|
||||||
* @package WooCommerce/Templates
|
* @package WooCommerce/Templates
|
||||||
* @version 3.0.0
|
* @version 3.9.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -23,25 +23,32 @@ if ( $related_products ) : ?>
|
||||||
|
|
||||||
<section class="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(); ?>
|
<?php woocommerce_product_loop_start(); ?>
|
||||||
|
|
||||||
<?php foreach ( $related_products as $related_product ) : ?>
|
<?php foreach ( $related_products as $related_product ) : ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$post_object = get_post( $related_product->get_id() );
|
$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 endforeach; ?>
|
||||||
|
|
||||||
<?php woocommerce_product_loop_end(); ?>
|
<?php woocommerce_product_loop_end(); ?>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
<?php
|
||||||
<?php endif;
|
endif;
|
||||||
|
|
||||||
wp_reset_postdata();
|
wp_reset_postdata();
|
||||||
|
|
Loading…
Reference in New Issue