diff --git a/includes/admin/class-wc-admin-addons.php b/includes/admin/class-wc-admin-addons.php index 90ff753d4e1..86fbb324fb3 100644 --- a/includes/admin/class-wc-admin-addons.php +++ b/includes/admin/class-wc-admin-addons.php @@ -17,6 +17,45 @@ if ( ! defined( 'ABSPATH' ) ) { */ class WC_Admin_Addons { + /** + * Handles the outputting of a contextually aware Storefront link (points to child themes if Storefront is already active). + */ + public static function output_storefront_button() { + $url = 'http://www.woothemes.com/storefront/'; + $text = __( 'View more about Storefront', 'woocommerce' ); + $template = get_option( 'template' ); + $stylesheet = get_option( 'stylesheet' ); + $utm_content = 'hasstorefront'; + + // If we're using Storefront with a child theme. + if ( 'storefront' == $template && 'storefront' != $stylesheet ) { + $url = 'http:///www.woothemes.com/product-category/themes/storefront-child-theme-themes/'; + $text = __( 'View more Storefront child themes', 'woocommerce' ); + $utm_content = 'hasstorefrontchildtheme'; + } + + // If we're using Storefront without a child theme. + if ( 'storefront' == $template && 'storefront' == $stylesheet ) { + $url = 'http:///www.woothemes.com/product-category/themes/storefront-child-theme-themes/'; + $text = __( 'Need a fresh look? Try Storefront child themes', 'woocommerce' ); + $utm_content = 'nostorefrontchildtheme'; + } + + // If we're not using Storefront at all. + if ( 'storefront' != $template && 'storefront' != $stylesheet ) { + $url = 'http://www.woothemes.com/storefront/'; + $text = __( 'Need a theme? Try Storefront', 'woocommerce' ); + $utm_content = 'nostorefront'; + } + + $url = add_query_arg( 'utm_source', 'product', $url ); + $url = add_query_arg( 'utm_medium', 'upsell', $url ); + $url = add_query_arg( 'utm_campaign', 'wcaddons', $url ); + $url = add_query_arg( 'utm_content', $utm_content, $url ); + + echo '' . esc_html( $text ) . '' . "\n"; + } + /** * Handles output of the reports page in admin. */ diff --git a/includes/admin/views/html-admin-page-addons.php b/includes/admin/views/html-admin-page-addons.php index f709f7a7558..3abc0815a47 100644 --- a/includes/admin/views/html-admin-page-addons.php +++ b/includes/admin/views/html-admin-page-addons.php @@ -19,7 +19,7 @@ $theme = wp_get_theme();

- +