Merge pull request #9649 from woothemes/contextual-storefront-button
Makes the "Try Storefront" button more contextual
This commit is contained in:
commit
784975bc31
|
@ -17,6 +17,45 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
*/
|
*/
|
||||||
class WC_Admin_Addons {
|
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 '<a href="' . esc_url( $url ) . '" class="add-new-h2">' . esc_html( $text ) . '</a>' . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles output of the reports page in admin.
|
* Handles output of the reports page in admin.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,7 +19,7 @@ $theme = wp_get_theme();
|
||||||
<h2>
|
<h2>
|
||||||
<?php _e( 'WooCommerce Add-ons/Extensions', 'woocommerce' ); ?>
|
<?php _e( 'WooCommerce Add-ons/Extensions', 'woocommerce' ); ?>
|
||||||
<a href="http://www.woothemes.com/product-category/woocommerce-extensions/" class="add-new-h2"><?php _e( 'Browse all extensions', 'woocommerce' ); ?></a>
|
<a href="http://www.woothemes.com/product-category/woocommerce-extensions/" class="add-new-h2"><?php _e( 'Browse all extensions', 'woocommerce' ); ?></a>
|
||||||
<a href="http://www.woothemes.com/storefront/" class="add-new-h2"><?php _e( 'Need a theme? Try Storefront', 'woocommerce' ); ?></a>
|
<?php WC_Admin_Addons::output_storefront_button(); ?>
|
||||||
</h2>
|
</h2>
|
||||||
<?php if ( $addons ) : ?>
|
<?php if ( $addons ) : ?>
|
||||||
<ul class="subsubsub">
|
<ul class="subsubsub">
|
||||||
|
|
Loading…
Reference in New Issue