Merge pull request #18888 from woocommerce/fix/18859

Don't prepend cats for regular shortcodes
This commit is contained in:
Claudiu Lodromanean 2018-02-08 10:41:43 -08:00 committed by GitHub
commit 170cf2d361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -482,6 +482,16 @@ class WC_Template_Loader {
return $content;
}
/**
* Are we filtering content for unsupported themes?
*
* @since 3.3.2
* @return bool
*/
public static function in_content_filter() {
return (bool) self::$in_content_filter;
}
/**
* Prevent the main featured image on product pages because there will be another featured image
* in the gallery.
@ -491,7 +501,7 @@ class WC_Template_Loader {
* @return string
*/
public static function unsupported_theme_single_featured_image_filter( $html ) {
if ( self::$in_content_filter || ! is_product() || ! is_main_query() ) {
if ( self::in_content_filter() || ! is_product() || ! is_main_query() ) {
return $html;
}

View File

@ -1818,6 +1818,10 @@ if ( ! function_exists( 'woocommerce_maybe_show_product_subcategories' ) ) {
* @return string
*/
function woocommerce_maybe_show_product_subcategories( $loop_html ) {
if ( wc_get_loop_prop( 'is_shortcode' ) && ! WC_Template_Loader::in_content_filter() ) {
return $loop_html;
}
$display_type = woocommerce_get_loop_display_mode();
// If displaying categories, append to the loop.