Merge pull request #17604 from woocommerce/improve/17549

Underscores wrappers
This commit is contained in:
Mike Jolley 2017-11-07 19:18:56 +00:00 committed by GitHub
commit ffa6637391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 6 deletions

View File

@ -2728,3 +2728,13 @@ function wc_page_noindex() {
} }
} }
add_action( 'wp_head', 'wc_page_noindex' ); add_action( 'wp_head', 'wc_page_noindex' );
/**
* Get a slug identifying the current theme.
*
* @since 3.3.0
* @return string
*/
function wc_get_theme_slug_for_templates() {
return apply_filters( 'woocommerce_theme_slug_for_templates', get_option( 'template' ) );
}

View File

@ -13,16 +13,19 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 1.6.4 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
$template = get_option( 'template' ); $template = wc_get_theme_slug_for_templates();
switch ( $template ) { switch ( $template ) {
case 'twentyten' :
echo '</div></div>';
break;
case 'twentyeleven' : case 'twentyeleven' :
echo '</div>'; echo '</div>';
get_sidebar( 'shop' ); get_sidebar( 'shop' );
@ -45,6 +48,6 @@ switch ( $template ) {
echo '</main></div>'; echo '</main></div>';
break; break;
default : default :
echo '</div></div>'; echo '</div></main>';
break; break;
} }

View File

@ -13,16 +13,19 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 1.6.4 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
$template = get_option( 'template' ); $template = wc_get_theme_slug_for_templates();
switch ( $template ) { switch ( $template ) {
case 'twentyten' :
echo '<div id="container"><div id="content" role="main">';
break;
case 'twentyeleven' : case 'twentyeleven' :
echo '<div id="primary"><div id="content" role="main" class="twentyeleven">'; echo '<div id="primary"><div id="content" role="main" class="twentyeleven">';
break; break;
@ -42,6 +45,6 @@ switch ( $template ) {
echo '<div id="primary" class="content-area twentysixteen"><main id="main" class="site-main" role="main">'; echo '<div id="primary" class="content-area twentysixteen"><main id="main" class="site-main" role="main">';
break; break;
default : default :
echo '<div id="container"><div id="content" role="main">'; echo '<div id="primary" class="content-area"><main id="main" class="site-main" role="main">';
break; break;
} }