Revert "Remove unsupported theme notice"

This reverts commit aad3792817.
This commit is contained in:
claudiulodro 2018-01-10 09:45:16 -08:00
parent aad3792817
commit d87497962b
2 changed files with 35 additions and 0 deletions

View File

@ -31,6 +31,7 @@ class WC_Admin_Notices {
'install' => 'install_notice', 'install' => 'install_notice',
'update' => 'update_notice', 'update' => 'update_notice',
'template_files' => 'template_file_check_notice', 'template_files' => 'template_file_check_notice',
'theme_support' => 'theme_check_notice',
'legacy_shipping' => 'legacy_shipping_notice', 'legacy_shipping' => 'legacy_shipping_notice',
'no_shipping_methods' => 'no_shipping_methods_notice', 'no_shipping_methods' => 'no_shipping_methods_notice',
'simplify_commerce' => 'simplify_commerce_notice', 'simplify_commerce' => 'simplify_commerce_notice',
@ -78,6 +79,10 @@ class WC_Admin_Notices {
* Reset notices for themes when switched or a new version of WC is installed. * Reset notices for themes when switched or a new version of WC is installed.
*/ */
public static function reset_admin_notices() { public static function reset_admin_notices() {
if ( ! current_theme_supports( 'woocommerce' ) ) {
self::add_notice( 'theme_support' );
}
$simplify_options = get_option( 'woocommerce_simplify_commerce_settings', array() ); $simplify_options = get_option( 'woocommerce_simplify_commerce_settings', array() );
$location = wc_get_base_location(); $location = wc_get_base_location();
@ -207,6 +212,17 @@ class WC_Admin_Notices {
include( 'views/html-notice-install.php' ); include( 'views/html-notice-install.php' );
} }
/**
* Show the Theme Check notice.
*/
public static function theme_check_notice() {
if ( ! current_theme_supports( 'woocommerce' ) ) {
include( 'views/html-notice-theme-support.php' );
} else {
self::remove_notice( 'theme_support' );
}
}
/** /**
* Show a notice highlighting bad template files. * Show a notice highlighting bad template files.
*/ */

View File

@ -0,0 +1,19 @@
<?php
/**
* Admin View: Notice - Theme Support
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="message" class="updated woocommerce-message wc-connect">
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'theme_support' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
<p><?php printf( __( '<strong>Your theme does not declare WooCommerce support</strong> &#8211; Please read our <a href="%1$s" target="_blank">integration</a> guide or check out our <a href="%2$s" target="_blank">Storefront</a> theme which is totally free to download and designed specifically for use with WooCommerce.', 'woocommerce' ), esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/', 'theme-compatibility' ) ), esc_url( self_admin_url( 'theme-install.php?theme=storefront' ) ) ); ?></p>
<p class="submit">
<a href="https://woocommerce.com/storefront/?utm_source=notice&amp;utm_medium=product&amp;utm_content=storefront&amp;utm_campaign=woocommerceplugin" class="button-primary" target="_blank"><?php _e( 'Read more about Storefront', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'http://docs.woocommerce.com/document/third-party-custom-theme-compatibility/?utm_source=notice&utm_medium=product&utm_content=themecompatibility&utm_campaign=woocommerceplugin' ) ); ?>" class="button-secondary" target="_blank"><?php _e( 'Theme integration guide', 'woocommerce' ); ?></a>
</p>
</div>