Only suppress comments number on unsupported theme shop page

This commit is contained in:
claudiulodro 2018-08-24 10:46:57 -07:00
parent 66c7c244ca
commit 2e87ec3bf1
1 changed files with 16 additions and 1 deletions

View File

@ -212,7 +212,7 @@ class WC_Template_Loader {
private static function unsupported_theme_shop_page_init() {
add_filter( 'the_content', array( __CLASS__, 'unsupported_theme_shop_content_filter' ), 10 );
add_filter( 'the_title', array( __CLASS__, 'unsupported_theme_title_filter' ), 10, 2 );
add_filter( 'comments_number', '__return_empty_string' );
add_filter( 'comments_number', array( __CLASS__, 'unsupported_theme_comments_number_filter' ) );
}
/**
@ -501,6 +501,21 @@ class WC_Template_Loader {
return $content;
}
/**
* Suppress the comments number on the Shop page for unsupported themes since there is no commenting on the Shop page.
*
* @since 3.4.5
* @param string $comments_number The comments number text.
* @return string
*/
public static function unsupported_theme_comments_number_filter( $comments_number ) {
if ( is_page( self::$shop_page_id ) ) {
return '';
}
return $comments_number;
}
/**
* Are we filtering content for unsupported themes?
*