Fix PHPCS violations

This commit is contained in:
Tiago Noronha 2018-06-22 15:11:39 +01:00
parent edc53f220c
commit 169c21e35a
31 changed files with 1180 additions and 809 deletions

23
404.php
View file

@ -46,9 +46,11 @@ get_header(); ?>
echo '<h2>' . esc_html__( 'Product Categories', 'storefront' ) . '</h2>';
the_widget( 'WC_Widget_Product_Categories', array(
'count' => 1,
) );
the_widget(
'WC_Widget_Product_Categories', array(
'count' => 1,
)
);
echo '</nav>';
@ -58,10 +60,14 @@ get_header(); ?>
echo '<h2>' . esc_html__( 'Popular Products', 'storefront' ) . '</h2>';
echo storefront_do_shortcode( 'best_selling_products', array(
'per_page' => 4,
'columns' => 4,
) );
$shortcode_content = storefront_do_shortcode(
'best_selling_products', array(
'per_page' => 4,
'columns' => 4,
)
);
echo wp_kses_post( $shortcode_content );
echo '</section>';
}
@ -73,4 +79,5 @@ get_header(); ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer();
<?php
get_footer();

View file

@ -21,13 +21,15 @@ get_header(); ?>
?>
</header><!-- .page-header -->
<?php get_template_part( 'loop' );
<?php
get_template_part( 'loop' );
else :
get_template_part( 'content', 'none' );
endif; ?>
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->

View file

@ -21,11 +21,13 @@ if ( post_password_required() ) {
<section id="comments" class="comments-area" aria-label="<?php esc_html_e( 'Post Comments', 'storefront' ); ?>">
<?php
if ( have_comments() ) : ?>
if ( have_comments() ) :
?>
<h2 class="comments-title">
<?php
printf( // WPCS: XSS OK.
esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'storefront' ) ),
/* translators: 1: number of comments, 2: post title */
esc_html( _nx( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'storefront' ) ),
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
);
@ -42,11 +44,13 @@ if ( post_password_required() ) {
<ol class="comment-list">
<?php
wp_list_comments( array(
'style' => 'ol',
'short_ping' => true,
'callback' => 'storefront_comment',
) );
wp_list_comments(
array(
'style' => 'ol',
'short_ping' => true,
'callback' => 'storefront_comment',
)
);
?>
</ol><!-- .comment-list -->
@ -56,19 +60,25 @@ if ( post_password_required() ) {
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'storefront' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'storefront' ) ); ?></div>
</nav><!-- #comment-nav-below -->
<?php endif; // Check for comment navigation.
<?php
endif; // Check for comment navigation.
endif;
if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'storefront' ); ?></p>
<?php endif;
<?php
endif;
$args = apply_filters( 'storefront_comment_form_args', array(
'title_reply_before' => '<span id="reply-title" class="gamma comment-reply-title">',
'title_reply_after' => '</span>',
) );
$args = apply_filters(
'storefront_comment_form_args', array(
'title_reply_before' => '<span id="reply-title" class="gamma comment-reply-title">',
'title_reply_after' => '</span>',
)
);
comment_form( $args ); ?>
comment_form( $args );
?>
</section><!-- #comments -->

View file

@ -10,7 +10,7 @@
$featured_image = get_the_post_thumbnail_url( get_the_ID(), 'thumbnail' );
?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="<?php storefront_homepage_content_styles(); ?>" data-featured-image="<?php echo $featured_image; ?>">
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="<?php storefront_homepage_content_styles(); ?>" data-featured-image="<?php echo esc_url( $featured_image ); ?>">
<div class="col-full">
<?php
/**

View file

@ -17,7 +17,12 @@
<div class="page-content">
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
<p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'storefront' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
<p>
<?php
/* translators: 1: URL */
printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'storefront' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) );
?>
</p>
<?php elseif ( is_search() ) : ?>

View file

@ -24,7 +24,8 @@
* @hooked storefront_footer_widgets - 10
* @hooked storefront_credit - 20
*/
do_action( 'storefront_footer' ); ?>
do_action( 'storefront_footer' );
?>
</div><!-- .col-full -->
</footer><!-- #colophon -->

View file

@ -43,7 +43,8 @@
* @hooked storefront_header_cart - 60
* @hooked storefront_primary_navigation_wrapper_close - 68
*/
do_action( 'storefront_header' ); ?>
do_action( 'storefront_header' );
?>
</header><!-- #masthead -->
@ -54,7 +55,8 @@
* @hooked storefront_header_widget_region - 10
* @hooked woocommerce_breadcrumb - 10
*/
do_action( 'storefront_before_content' ); ?>
do_action( 'storefront_before_content' );
?>
<div id="content" class="site-content" tabindex="-1">
<div class="col-full">

View file

@ -22,8 +22,8 @@ if ( ! class_exists( 'Storefront_Admin' ) ) :
* @since 1.0
*/
public function __construct() {
add_action( 'admin_menu', array( $this, 'welcome_register_menu' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'welcome_style' ) );
add_action( 'admin_menu', array( $this, 'welcome_register_menu' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'welcome_style' ) );
}
/**
@ -87,7 +87,8 @@ if ( ! class_exists( 'Storefront_Admin' ) ) :
$referrer = wp_get_referer();
if ( strpos( $referrer, 'sf_starter_content' ) !== false ) {
echo '<h1>' . sprintf( esc_attr__( 'Setup complete %sYour Storefront adventure begins now 🚀%s ', 'storefront' ), '<span>', '</span>' ) . '</h1>';
/* translators: 1: HTML, 2: HTML */
echo '<h1>' . sprintf( esc_attr__( 'Setup complete %1$sYour Storefront adventure begins now 🚀%2$s ', 'storefront' ), '<span>', '</span>' ) . '</h1>';
echo '<p>' . esc_attr__( 'One more thing... You might be interested in the following Storefront extensions and designs.', 'storefront' ) . '</p>';
} else {
echo '<p>' . esc_attr__( 'Hello! You might be interested in the following Storefront extensions and designs.', 'storefront' ) . '</p>';
@ -139,7 +140,10 @@ if ( ! class_exists( 'Storefront_Admin' ) ) :
<div class="automattic">
<p>
<?php printf( esc_html__( 'An %s project', 'storefront' ), '<a href="https://automattic.com/"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/admin/welcome-screen/automattic.png" alt="Automattic" /></a>' ); ?>
<?php
/* translators: %s: Automattic branding */
printf( esc_html__( 'An %s project', 'storefront' ), '<a href="https://automattic.com/"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/admin/welcome-screen/automattic.png" alt="Automattic" /></a>' );
?>
</p>
</div>
</div>
@ -165,31 +169,31 @@ if ( ! class_exists( 'Storefront_Admin' ) ) :
public function install_plugin_button( $plugin_slug, $plugin_file ) {
if ( current_user_can( 'install_plugins' ) && current_user_can( 'activate_plugins' ) ) {
if ( is_plugin_active( $plugin_slug . '/' . $plugin_file ) ) {
/**
* The plugin is already active
*/
// The plugin is already active.
$button = array(
'message' => esc_attr__( 'Activated', 'storefront' ),
'url' => '#',
'classes' => 'disabled',
);
} elseif ( $url = $this->_is_plugin_installed( $plugin_slug ) ) {
/**
* The plugin exists but isn't activated yet.
*/
} elseif ( $this->_is_plugin_installed( $plugin_slug ) ) {
$url = $this->_is_plugin_installed( $plugin_slug );
// The plugin exists but isn't activated yet.
$button = array(
'message' => esc_attr__( 'Activate', 'storefront' ),
'url' => $url,
'classes' => 'activate-now',
);
} else {
/**
* The plugin doesn't exist.
*/
$url = wp_nonce_url( add_query_arg( array(
'action' => 'install-plugin',
'plugin' => $plugin_slug,
), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug );
// The plugin doesn't exist.
$url = wp_nonce_url(
add_query_arg(
array(
'action' => 'install-plugin',
'plugin' => $plugin_slug,
), self_admin_url( 'update.php' )
), 'install-plugin_' . $plugin_slug
);
$button = array(
'message' => esc_attr__( 'Install now', 'storefront' ),
'url' => $url,
@ -214,10 +218,14 @@ if ( ! class_exists( 'Storefront_Admin' ) ) :
if ( ! empty( $plugins ) ) {
$keys = array_keys( $plugins );
$plugin_file = $plugin_slug . '/' . $keys[0];
$url = wp_nonce_url( add_query_arg( array(
'action' => 'activate',
'plugin' => $plugin_file,
), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file );
$url = wp_nonce_url(
add_query_arg(
array(
'action' => 'activate',
'plugin' => $plugin_file,
), admin_url( 'plugins.php' )
), 'activate-plugin_' . $plugin_file
);
return $url;
}
}

View file

@ -48,11 +48,16 @@ if ( ! class_exists( 'Storefront_Plugin_Install' ) ) :
*
* @param string $plugin_slug The plugin slug.
* @param string $plugin_file The plugin file.
* @param string $plugin_name The plugin name.
* @param string $classes CSS classes.
* @param string $activated Button activated text.
* @param string $activate Button activate text.
* @param string $install Button install text.
*/
public static function install_plugin_button( $plugin_slug, $plugin_file, $plugin_name, $classes = array(), $activated = '', $activate = '', $install = '' ) {
if ( current_user_can( 'install_plugins' ) && current_user_can( 'activate_plugins' ) ) {
if ( is_plugin_active( $plugin_slug . '/' . $plugin_file ) ) {
// The plugin is already active
// The plugin is already active.
$button = array(
'message' => esc_attr__( 'Activated', 'storefront' ),
'url' => '#',
@ -62,7 +67,9 @@ if ( ! class_exists( 'Storefront_Plugin_Install' ) ) :
if ( '' !== $activated ) {
$button['message'] = esc_attr( $activated );
}
} elseif ( $url = self::_is_plugin_installed( $plugin_slug ) ) {
} elseif ( self::_is_plugin_installed( $plugin_slug ) ) {
$url = self::_is_plugin_installed( $plugin_slug );
// The plugin exists but isn't activated yet.
$button = array(
'message' => esc_attr__( 'Activate', 'storefront' ),
@ -75,10 +82,14 @@ if ( ! class_exists( 'Storefront_Plugin_Install' ) ) :
}
} else {
// The plugin doesn't exist.
$url = wp_nonce_url( add_query_arg( array(
'action' => 'install-plugin',
'plugin' => $plugin_slug,
), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug );
$url = wp_nonce_url(
add_query_arg(
array(
'action' => 'install-plugin',
'plugin' => $plugin_slug,
), self_admin_url( 'update.php' )
), 'install-plugin_' . $plugin_slug
);
$button = array(
'message' => esc_attr__( 'Install now', 'storefront' ),
'url' => $url,
@ -116,10 +127,14 @@ if ( ! class_exists( 'Storefront_Plugin_Install' ) ) :
if ( ! empty( $plugins ) ) {
$keys = array_keys( $plugins );
$plugin_file = $plugin_slug . '/' . $keys[0];
$url = wp_nonce_url( add_query_arg( array(
'action' => 'activate',
'plugin' => $plugin_file,
), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file );
$url = wp_nonce_url(
add_query_arg(
array(
'action' => 'activate',
'plugin' => $plugin_file,
), admin_url( 'plugins.php' )
), 'activate-plugin_' . $plugin_file
);
return $url;
}
}

View file

@ -23,14 +23,14 @@ if ( ! class_exists( 'Storefront' ) ) :
* @since 1.0
*/
public function __construct() {
add_action( 'after_setup_theme', array( $this, 'setup' ) );
add_action( 'widgets_init', array( $this, 'widgets_init' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ), 10 );
add_action( 'wp_enqueue_scripts', array( $this, 'child_scripts' ), 30 ); // After WooCommerce.
add_filter( 'body_class', array( $this, 'body_classes' ) );
add_filter( 'wp_page_menu_args', array( $this, 'page_menu_args' ) );
add_action( 'after_setup_theme', array( $this, 'setup' ) );
add_action( 'widgets_init', array( $this, 'widgets_init' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ), 10 );
add_action( 'wp_enqueue_scripts', array( $this, 'child_scripts' ), 30 ); // After WooCommerce.
add_filter( 'body_class', array( $this, 'body_classes' ) );
add_filter( 'wp_page_menu_args', array( $this, 'page_menu_args' ) );
add_filter( 'navigation_markup_template', array( $this, 'navigation_markup_template' ) );
add_action( 'enqueue_embed_scripts', array( $this, 'print_embed_styles' ) );
add_action( 'enqueue_embed_scripts', array( $this, 'print_embed_styles' ) );
}
/**
@ -71,63 +71,87 @@ if ( ! class_exists( 'Storefront' ) ) :
/**
* Enable support for site logo.
*/
add_theme_support( 'custom-logo', apply_filters( 'storefront_custom_logo_args', array(
'height' => 110,
'width' => 470,
'flex-width' => true,
'flex-height' => true,
) ) );
add_theme_support(
'custom-logo', apply_filters(
'storefront_custom_logo_args', array(
'height' => 110,
'width' => 470,
'flex-width' => true,
'flex-height' => true,
)
)
);
/**
* Register menu locations.
*/
register_nav_menus( apply_filters( 'storefront_register_nav_menus', array(
'primary' => __( 'Primary Menu', 'storefront' ),
'secondary' => __( 'Secondary Menu', 'storefront' ),
'handheld' => __( 'Handheld Menu', 'storefront' ),
) ) );
register_nav_menus(
apply_filters(
'storefront_register_nav_menus', array(
'primary' => __( 'Primary Menu', 'storefront' ),
'secondary' => __( 'Secondary Menu', 'storefront' ),
'handheld' => __( 'Handheld Menu', 'storefront' ),
)
)
);
/*
* Switch default core markup for search form, comment form, comments, galleries, captions and widgets
* to output valid HTML5.
*/
add_theme_support( 'html5', apply_filters( 'storefront_html5_args', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'widgets',
) ) );
add_theme_support(
'html5', apply_filters(
'storefront_html5_args', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'widgets',
)
)
);
/**
* Setup the WordPress core custom background feature.
*/
add_theme_support( 'custom-background', apply_filters( 'storefront_custom_background_args', array(
'default-color' => apply_filters( 'storefront_default_background_color', 'ffffff' ),
'default-image' => '',
) ) );
add_theme_support(
'custom-background', apply_filters(
'storefront_custom_background_args', array(
'default-color' => apply_filters( 'storefront_default_background_color', 'ffffff' ),
'default-image' => '',
)
)
);
/**
* Setup the WordPress core custom header feature.
*/
add_theme_support( 'custom-header', apply_filters( 'storefront_custom_header_args', array(
'default-image' => '',
'header-text' => false,
'width' => 1950,
'height' => 500,
'flex-width' => true,
'flex-height' => true,
) ) );
add_theme_support(
'custom-header', apply_filters(
'storefront_custom_header_args', array(
'default-image' => '',
'header-text' => false,
'width' => 1950,
'height' => 500,
'flex-width' => true,
'flex-height' => true,
)
)
);
/**
* Add support for the Site Logo plugin and the site logo functionality in JetPack
* https://github.com/automattic/site-logo
* http://jetpack.me/
*/
add_theme_support( 'site-logo', apply_filters( 'storefront_site_logo_args', array(
'size' => 'full'
) ) );
add_theme_support(
'site-logo', apply_filters(
'storefront_site_logo_args', array(
'size' => 'full',
)
)
);
/**
* Declare support for title theme feature.
@ -149,7 +173,7 @@ if ( ! class_exists( 'Storefront' ) ) :
$sidebar_args['sidebar'] = array(
'name' => __( 'Sidebar', 'storefront' ),
'id' => 'sidebar-1',
'description' => ''
'description' => '',
);
$sidebar_args['header'] = array(
@ -167,10 +191,16 @@ if ( ! class_exists( 'Storefront' ) ) :
$footer = sprintf( 'footer_%d', $footer_n );
if ( 1 == $rows ) {
/* translators: 1: column number */
$footer_region_name = sprintf( __( 'Footer Column %1$d', 'storefront' ), $region );
/* translators: 1: column number */
$footer_region_description = sprintf( __( 'Widgets added here will appear in column %1$d of the footer.', 'storefront' ), $region );
} else {
/* translators: 1: row number, 2: column number */
$footer_region_name = sprintf( __( 'Footer Row %1$d - Column %2$d', 'storefront' ), $row, $region );
/* translators: 1: column number, 2: row number */
$footer_region_description = sprintf( __( 'Widgets added here will appear in column %1$d of footer row %2$d.', 'storefront' ), $region, $row );
}
@ -232,9 +262,11 @@ if ( ! class_exists( 'Storefront' ) ) :
/**
* Fonts
*/
$google_fonts = apply_filters( 'storefront_google_font_families', array(
'source-sans-pro' => 'Source+Sans+Pro:400,300,300italic,400italic,600,700,900',
) );
$google_fonts = apply_filters(
'storefront_google_font_families', array(
'source-sans-pro' => 'Source+Sans+Pro:400,300,300italic,400italic,600,700,900',
)
);
$query_args = array(
'family' => implode( '|', $google_fonts ),

View file

@ -1,4 +1,4 @@
<?php
<?php // @codingStandardsIgnoreLine.
/**
* Class to create a custom arbitrary html control for dividers etc
*
@ -19,7 +19,7 @@ class Arbitrary_Storefront_Control extends WP_Customize_Control {
*
* @var string $settings the blog name.
*/
public $settings = 'blogname';
public $settings = 'blogname';
/**
* The description var
@ -36,17 +36,17 @@ class Arbitrary_Storefront_Control extends WP_Customize_Control {
public function render_content() {
switch ( $this->type ) {
default:
case 'text' :
case 'text':
echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
break;
break;
case 'heading':
echo '<span class="customize-control-title">' . esc_html( $this->label ) . '</span>';
break;
break;
case 'divider' :
case 'divider':
echo '<hr style="margin: 1em 0;" />';
break;
break;
}
}
}

View file

@ -1,4 +1,4 @@
<?php
<?php // @codingStandardsIgnoreLine.
/**
* Class to create a Customizer control for displaying information
*
@ -24,13 +24,24 @@ class More_Storefront_Control extends WP_Customize_Control {
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<p>
<?php printf( esc_html__( 'There\'s a range of %s extensions available to put additional power in your hands. Check out the %s%s%s page in your dashboard for more information.', 'storefront' ), 'Storefront', '<a href="' . esc_url( admin_url() . 'themes.php?page=storefront-welcome' ) .'">', 'Storefront', '</a>' ); ?>
<?php
/* translators: 1: Storefront, 2: start <a> tag, 3: Storefront, 4: end <a> tag */
printf( esc_html__( 'There\'s a range of %1$s extensions available to put additional power in your hands. Check out the %2$s%3$s%4$s page in your dashboard for more information.', 'storefront' ), 'Storefront', '<a href="' . esc_url( admin_url() . 'themes.php?page=storefront-welcome' ) . '">', 'Storefront', '</a>' );
?>
</p>
<span class="customize-control-title"><?php printf( esc_html__( 'Enjoying %s?', 'storefront' ), 'Storefront' ); ?></span>
<span class="customize-control-title">
<?php
/* translators: %s: Storefront */
printf( esc_html__( 'Enjoying %s?', 'storefront' ), 'Storefront' );
?>
</span>
<p>
<?php printf( esc_html__( 'Why not leave us a review on %sWordPress.org%s? We\'d really appreciate it!', 'storefront' ), '<a href="https://wordpress.org/themes/storefront">', '</a>' ); ?>
<?php
/* translators: 1: start <a> tag, 2: end <a> tag */
printf( esc_html__( 'Why not leave us a review on %1$sWordPress.org%2$s? We\'d really appreciate it!', 'storefront' ), '<a href="https://wordpress.org/themes/storefront">', '</a>' );
?>
</p>
</label>

View file

@ -1,4 +1,4 @@
<?php
<?php // @codingStandardsIgnoreLine.
/**
* Create a Radio-Image control
*
@ -25,7 +25,6 @@ class Storefront_Custom_Radio_Image_Control extends WP_Customize_Control {
/**
* Declare the control type.
*
* @access public
* @var string
*/
public $type = 'radio-image';
@ -37,8 +36,6 @@ class Storefront_Custom_Radio_Image_Control extends WP_Customize_Control {
*
* Note, you can also enqueue stylesheets here as well. Stylesheets are hooked
* at 'customize_controls_print_styles'.
*
* @access public
*/
public function enqueue() {
wp_enqueue_script( 'jquery-ui-button' );
@ -64,7 +61,12 @@ class Storefront_Custom_Radio_Image_Control extends WP_Customize_Control {
<div id="input_<?php echo esc_attr( $this->id ); ?>" class="image">
<?php foreach ( $this->choices as $value => $label ) : ?>
<input class="image-select" type="radio" value="<?php echo esc_attr( $value ); ?>" id="<?php echo esc_attr( $this->id . $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?>>
<input class="image-select" type="radio" value="<?php echo esc_attr( $value ); ?>" id="<?php echo esc_attr( $this->id . $value ); ?>" name="<?php echo esc_attr( $name ); ?>"
<?php
$this->link();
checked( $this->value(), $value );
?>
>
<label for="<?php echo esc_attr( $this->id ) . esc_attr( $value ); ?>">
<img src="<?php echo esc_html( $label ); ?>" alt="<?php echo esc_attr( $value ); ?>" title="<?php echo esc_attr( $value ); ?>">
</label>

View file

@ -23,12 +23,12 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customize_register' ), 10 );
add_filter( 'body_class', array( $this, 'layout_class' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'add_customizer_css' ), 130 );
add_action( 'customize_register', array( $this, 'customize_register' ), 10 );
add_filter( 'body_class', array( $this, 'layout_class' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'add_customizer_css' ), 130 );
add_action( 'customize_controls_print_styles', array( $this, 'customizer_custom_control_css' ) );
add_action( 'customize_register', array( $this, 'edit_default_customizer_settings' ), 99 );
add_action( 'init', array( $this, 'default_theme_mod_values' ), 10 );
add_action( 'customize_register', array( $this, 'edit_default_customizer_settings' ), 99 );
add_action( 'init', array( $this, 'default_theme_mod_values' ), 10 );
}
/**
@ -37,26 +37,28 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
* @return array
*/
public static function get_storefront_default_setting_values() {
return apply_filters( 'storefront_setting_default_values', $args = array(
'storefront_heading_color' => '#333333',
'storefront_text_color' => '#6d6d6d',
'storefront_accent_color' => '#96588a',
'storefront_hero_heading_color' => '#000000',
'storefront_hero_text_color' => '#000000',
'storefront_header_background_color' => '#ffffff',
'storefront_header_text_color' => '#404040',
'storefront_header_link_color' => '#333333',
'storefront_footer_background_color' => '#f0f0f0',
'storefront_footer_heading_color' => '#333333',
'storefront_footer_text_color' => '#6d6d6d',
'storefront_footer_link_color' => '#333333',
'storefront_button_background_color' => '#eeeeee',
'storefront_button_text_color' => '#333333',
'storefront_button_alt_background_color' => '#333333',
'storefront_button_alt_text_color' => '#ffffff',
'storefront_layout' => 'right',
'background_color' => 'ffffff',
) );
return apply_filters(
'storefront_setting_default_values', $args = array(
'storefront_heading_color' => '#333333',
'storefront_text_color' => '#6d6d6d',
'storefront_accent_color' => '#96588a',
'storefront_hero_heading_color' => '#000000',
'storefront_hero_text_color' => '#000000',
'storefront_header_background_color' => '#ffffff',
'storefront_header_text_color' => '#404040',
'storefront_header_link_color' => '#333333',
'storefront_footer_background_color' => '#f0f0f0',
'storefront_footer_heading_color' => '#333333',
'storefront_footer_text_color' => '#6d6d6d',
'storefront_footer_link_color' => '#333333',
'storefront_button_background_color' => '#eeeeee',
'storefront_button_text_color' => '#333333',
'storefront_button_alt_background_color' => '#333333',
'storefront_button_alt_text_color' => '#ffffff',
'storefront_layout' => 'right',
'background_color' => 'ffffff',
)
);
}
/**
@ -73,7 +75,7 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
/**
* Get theme mod value.
*
* @param string $value
* @param string $value Theme modification value.
* @return string
*/
public function get_theme_mod_value( $value ) {
@ -128,20 +130,26 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial( 'custom_logo', array(
'selector' => '.site-branding',
'render_callback' => array( $this, 'get_site_logo' ),
) );
$wp_customize->selective_refresh->add_partial(
'custom_logo', array(
'selector' => '.site-branding',
'render_callback' => array( $this, 'get_site_logo' ),
)
);
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title.beta a',
'render_callback' => array( $this, 'get_site_name' ),
) );
$wp_customize->selective_refresh->add_partial(
'blogname', array(
'selector' => '.site-title.beta a',
'render_callback' => array( $this, 'get_site_name' ),
)
);
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'render_callback' => array( $this, 'get_site_description' ),
) );
$wp_customize->selective_refresh->add_partial(
'blogdescription', array(
'selector' => '.site-description',
'render_callback' => array( $this, 'get_site_description' ),
)
);
}
/**
@ -157,322 +165,444 @@ if ( ! class_exists( 'Storefront_Customizer' ) ) :
/**
* Add the typography section
*/
$wp_customize->add_section( 'storefront_typography' , array(
'title' => __( 'Typography', 'storefront' ),
'priority' => 45,
) );
$wp_customize->add_section(
'storefront_typography', array(
'title' => __( 'Typography', 'storefront' ),
'priority' => 45,
)
);
/**
* Heading color
*/
$wp_customize->add_setting( 'storefront_heading_color', array(
'default' => apply_filters( 'storefront_default_heading_color', '#484c51' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_heading_color', array(
'default' => apply_filters( 'storefront_default_heading_color', '#484c51' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_heading_color', array(
'label' => __( 'Heading color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_heading_color',
'priority' => 20,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_heading_color', array(
'label' => __( 'Heading color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_heading_color',
'priority' => 20,
)
)
);
/**
* Text Color
*/
$wp_customize->add_setting( 'storefront_text_color', array(
'default' => apply_filters( 'storefront_default_text_color', '#43454b' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_text_color', array(
'default' => apply_filters( 'storefront_default_text_color', '#43454b' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_text_color', array(
'label' => __( 'Text color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_text_color',
'priority' => 30,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_text_color', array(
'label' => __( 'Text color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_text_color',
'priority' => 30,
)
)
);
/**
* Accent Color
*/
$wp_customize->add_setting( 'storefront_accent_color', array(
'default' => apply_filters( 'storefront_default_accent_color', '#96588a' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_accent_color', array(
'default' => apply_filters( 'storefront_default_accent_color', '#96588a' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_accent_color', array(
'label' => __( 'Link / accent color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_accent_color',
'priority' => 40,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_accent_color', array(
'label' => __( 'Link / accent color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_accent_color',
'priority' => 40,
)
)
);
/**
* Hero Heading Color
*/
$wp_customize->add_setting( 'storefront_hero_heading_color', array(
'default' => apply_filters( 'storefront_default_hero_heading_color', '#000000' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_hero_heading_color', array(
'default' => apply_filters( 'storefront_default_hero_heading_color', '#000000' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_hero_heading_color', array(
'label' => __( 'Hero heading color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_hero_heading_color',
'priority' => 50,
'active_callback' => array( $this, 'is_homepage_template' ),
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_hero_heading_color', array(
'label' => __( 'Hero heading color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_hero_heading_color',
'priority' => 50,
'active_callback' => array( $this, 'is_homepage_template' ),
)
)
);
/**
* Hero Text Color
*/
$wp_customize->add_setting( 'storefront_hero_text_color', array(
'default' => apply_filters( 'storefront_default_hero_text_color', '#000000' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_hero_text_color', array(
'default' => apply_filters( 'storefront_default_hero_text_color', '#000000' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_hero_text_color', array(
'label' => __( 'Hero text color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_hero_text_color',
'priority' => 60,
'active_callback' => array( $this, 'is_homepage_template' ),
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_hero_text_color', array(
'label' => __( 'Hero text color', 'storefront' ),
'section' => 'storefront_typography',
'settings' => 'storefront_hero_text_color',
'priority' => 60,
'active_callback' => array( $this, 'is_homepage_template' ),
)
)
);
$wp_customize->add_control( new Arbitrary_Storefront_Control( $wp_customize, 'storefront_header_image_heading', array(
'section' => 'header_image',
'type' => 'heading',
'label' => __( 'Header background image', 'storefront' ),
'priority' => 6,
) ) );
$wp_customize->add_control(
new Arbitrary_Storefront_Control(
$wp_customize, 'storefront_header_image_heading', array(
'section' => 'header_image',
'type' => 'heading',
'label' => __( 'Header background image', 'storefront' ),
'priority' => 6,
)
)
);
/**
* Header Background
*/
$wp_customize->add_setting( 'storefront_header_background_color', array(
'default' => apply_filters( 'storefront_default_header_background_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_header_background_color', array(
'default' => apply_filters( 'storefront_default_header_background_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_header_background_color', array(
'label' => __( 'Background color', 'storefront' ),
'section' => 'header_image',
'settings' => 'storefront_header_background_color',
'priority' => 15,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_header_background_color', array(
'label' => __( 'Background color', 'storefront' ),
'section' => 'header_image',
'settings' => 'storefront_header_background_color',
'priority' => 15,
)
)
);
/**
* Header text color
*/
$wp_customize->add_setting( 'storefront_header_text_color', array(
'default' => apply_filters( 'storefront_default_header_text_color', '#9aa0a7' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_header_text_color', array(
'default' => apply_filters( 'storefront_default_header_text_color', '#9aa0a7' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_header_text_color', array(
'label' => __( 'Text color', 'storefront' ),
'section' => 'header_image',
'settings' => 'storefront_header_text_color',
'priority' => 20,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_header_text_color', array(
'label' => __( 'Text color', 'storefront' ),
'section' => 'header_image',
'settings' => 'storefront_header_text_color',
'priority' => 20,
)
)
);
/**
* Header link color
*/
$wp_customize->add_setting( 'storefront_header_link_color', array(
'default' => apply_filters( 'storefront_default_header_link_color', '#d5d9db' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_header_link_color', array(
'default' => apply_filters( 'storefront_default_header_link_color', '#d5d9db' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_header_link_color', array(
'label' => __( 'Link color', 'storefront' ),
'section' => 'header_image',
'settings' => 'storefront_header_link_color',
'priority' => 30,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_header_link_color', array(
'label' => __( 'Link color', 'storefront' ),
'section' => 'header_image',
'settings' => 'storefront_header_link_color',
'priority' => 30,
)
)
);
/**
* Footer section
*/
$wp_customize->add_section( 'storefront_footer' , array(
'title' => __( 'Footer', 'storefront' ),
'priority' => 28,
'description' => __( 'Customize the look & feel of your website footer.', 'storefront' ),
) );
$wp_customize->add_section(
'storefront_footer', array(
'title' => __( 'Footer', 'storefront' ),
'priority' => 28,
'description' => __( 'Customize the look & feel of your website footer.', 'storefront' ),
)
);
/**
* Footer Background
*/
$wp_customize->add_setting( 'storefront_footer_background_color', array(
'default' => apply_filters( 'storefront_default_footer_background_color', '#f0f0f0' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_footer_background_color', array(
'default' => apply_filters( 'storefront_default_footer_background_color', '#f0f0f0' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_footer_background_color', array(
'label' => __( 'Background color', 'storefront' ),
'section' => 'storefront_footer',
'settings' => 'storefront_footer_background_color',
'priority' => 10,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_footer_background_color', array(
'label' => __( 'Background color', 'storefront' ),
'section' => 'storefront_footer',
'settings' => 'storefront_footer_background_color',
'priority' => 10,
)
)
);
/**
* Footer heading color
*/
$wp_customize->add_setting( 'storefront_footer_heading_color', array(
'default' => apply_filters( 'storefront_default_footer_heading_color', '#494c50' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_footer_heading_color', array(
'default' => apply_filters( 'storefront_default_footer_heading_color', '#494c50' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_footer_heading_color', array(
'label' => __( 'Heading color', 'storefront' ),
'section' => 'storefront_footer',
'settings' => 'storefront_footer_heading_color',
'priority' => 20,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_footer_heading_color', array(
'label' => __( 'Heading color', 'storefront' ),
'section' => 'storefront_footer',
'settings' => 'storefront_footer_heading_color',
'priority' => 20,
)
)
);
/**
* Footer text color
*/
$wp_customize->add_setting( 'storefront_footer_text_color', array(
'default' => apply_filters( 'storefront_default_footer_text_color', '#61656b' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_footer_text_color', array(
'default' => apply_filters( 'storefront_default_footer_text_color', '#61656b' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_footer_text_color', array(
'label' => __( 'Text color', 'storefront' ),
'section' => 'storefront_footer',
'settings' => 'storefront_footer_text_color',
'priority' => 30,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_footer_text_color', array(
'label' => __( 'Text color', 'storefront' ),
'section' => 'storefront_footer',
'settings' => 'storefront_footer_text_color',
'priority' => 30,
)
)
);
/**
* Footer link color
*/
$wp_customize->add_setting( 'storefront_footer_link_color', array(
'default' => apply_filters( 'storefront_default_footer_link_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_footer_link_color', array(
'default' => apply_filters( 'storefront_default_footer_link_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_footer_link_color', array(
'label' => __( 'Link color', 'storefront' ),
'section' => 'storefront_footer',
'settings' => 'storefront_footer_link_color',
'priority' => 40,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_footer_link_color', array(
'label' => __( 'Link color', 'storefront' ),
'section' => 'storefront_footer',
'settings' => 'storefront_footer_link_color',
'priority' => 40,
)
)
);
/**
* Buttons section
*/
$wp_customize->add_section( 'storefront_buttons' , array(
'title' => __( 'Buttons', 'storefront' ),
'priority' => 45,
'description' => __( 'Customize the look & feel of your website buttons.', 'storefront' ),
) );
$wp_customize->add_section(
'storefront_buttons', array(
'title' => __( 'Buttons', 'storefront' ),
'priority' => 45,
'description' => __( 'Customize the look & feel of your website buttons.', 'storefront' ),
)
);
/**
* Button background color
*/
$wp_customize->add_setting( 'storefront_button_background_color', array(
'default' => apply_filters( 'storefront_default_button_background_color', '#96588a' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_button_background_color', array(
'default' => apply_filters( 'storefront_default_button_background_color', '#96588a' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_button_background_color', array(
'label' => __( 'Background color', 'storefront' ),
'section' => 'storefront_buttons',
'settings' => 'storefront_button_background_color',
'priority' => 10,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_button_background_color', array(
'label' => __( 'Background color', 'storefront' ),
'section' => 'storefront_buttons',
'settings' => 'storefront_button_background_color',
'priority' => 10,
)
)
);
/**
* Button text color
*/
$wp_customize->add_setting( 'storefront_button_text_color', array(
'default' => apply_filters( 'storefront_default_button_text_color', '#ffffff' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_button_text_color', array(
'default' => apply_filters( 'storefront_default_button_text_color', '#ffffff' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_button_text_color', array(
'label' => __( 'Text color', 'storefront' ),
'section' => 'storefront_buttons',
'settings' => 'storefront_button_text_color',
'priority' => 20,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_button_text_color', array(
'label' => __( 'Text color', 'storefront' ),
'section' => 'storefront_buttons',
'settings' => 'storefront_button_text_color',
'priority' => 20,
)
)
);
/**
* Button alt background color
*/
$wp_customize->add_setting( 'storefront_button_alt_background_color', array(
'default' => apply_filters( 'storefront_default_button_alt_background_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_button_alt_background_color', array(
'default' => apply_filters( 'storefront_default_button_alt_background_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_button_alt_background_color', array(
'label' => __( 'Alternate button background color', 'storefront' ),
'section' => 'storefront_buttons',
'settings' => 'storefront_button_alt_background_color',
'priority' => 30,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_button_alt_background_color', array(
'label' => __( 'Alternate button background color', 'storefront' ),
'section' => 'storefront_buttons',
'settings' => 'storefront_button_alt_background_color',
'priority' => 30,
)
)
);
/**
* Button alt text color
*/
$wp_customize->add_setting( 'storefront_button_alt_text_color', array(
'default' => apply_filters( 'storefront_default_button_alt_text_color', '#ffffff' ),
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting(
'storefront_button_alt_text_color', array(
'default' => apply_filters( 'storefront_default_button_alt_text_color', '#ffffff' ),
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_button_alt_text_color', array(
'label' => __( 'Alternate button text color', 'storefront' ),
'section' => 'storefront_buttons',
'settings' => 'storefront_button_alt_text_color',
'priority' => 40,
) ) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'storefront_button_alt_text_color', array(
'label' => __( 'Alternate button text color', 'storefront' ),
'section' => 'storefront_buttons',
'settings' => 'storefront_button_alt_text_color',
'priority' => 40,
)
)
);
/**
* Layout
*/
$wp_customize->add_section( 'storefront_layout' , array(
'title' => __( 'Layout', 'storefront' ),
'priority' => 50,
) );
$wp_customize->add_section(
'storefront_layout', array(
'title' => __( 'Layout', 'storefront' ),
'priority' => 50,
)
);
$wp_customize->add_setting( 'storefront_layout', array(
'default' => apply_filters( 'storefront_default_layout', $layout = is_rtl() ? 'left' : 'right' ),
'sanitize_callback' => 'storefront_sanitize_choices',
) );
$wp_customize->add_setting(
'storefront_layout', array(
'default' => apply_filters( 'storefront_default_layout', $layout = is_rtl() ? 'left' : 'right' ),
'sanitize_callback' => 'storefront_sanitize_choices',
)
);
$wp_customize->add_control( new Storefront_Custom_Radio_Image_Control( $wp_customize, 'storefront_layout', array(
'settings' => 'storefront_layout',
'section' => 'storefront_layout',
'label' => __( 'General Layout', 'storefront' ),
'priority' => 1,
'choices' => array(
'right' => get_template_directory_uri() . '/assets/images/customizer/controls/2cr.png',
'left' => get_template_directory_uri() . '/assets/images/customizer/controls/2cl.png',
),
) ) );
$wp_customize->add_control(
new Storefront_Custom_Radio_Image_Control(
$wp_customize, 'storefront_layout', array(
'settings' => 'storefront_layout',
'section' => 'storefront_layout',
'label' => __( 'General Layout', 'storefront' ),
'priority' => 1,
'choices' => array(
'right' => get_template_directory_uri() . '/assets/images/customizer/controls/2cr.png',
'left' => get_template_directory_uri() . '/assets/images/customizer/controls/2cl.png',
),
)
)
);
/**
* More
*/
if ( apply_filters( 'storefront_customizer_more', true ) ) {
$wp_customize->add_section( 'storefront_more' , array(
'title' => __( 'More', 'storefront' ),
'priority' => 999,
) );
$wp_customize->add_section(
'storefront_more', array(
'title' => __( 'More', 'storefront' ),
'priority' => 999,
)
);
$wp_customize->add_setting( 'storefront_more', array(
'default' => null,
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_setting(
'storefront_more', array(
'default' => null,
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control( new More_Storefront_Control( $wp_customize, 'storefront_more', array(
'label' => __( 'Looking for more options?', 'storefront' ),
'section' => 'storefront_more',
'settings' => 'storefront_more',
'priority' => 1,
) ) );
$wp_customize->add_control(
new More_Storefront_Control(
$wp_customize, 'storefront_more', array(
'label' => __( 'Looking for more options?', 'storefront' ),
'section' => 'storefront_more',
'settings' => 'storefront_more',
'priority' => 1,
)
)
);
}
}

View file

@ -23,8 +23,8 @@ if ( ! class_exists( 'Storefront_Jetpack' ) ) :
* @since 1.0
*/
public function __construct() {
add_action( 'init', array( $this, 'jetpack_setup' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'jetpack_scripts' ), 10 );
add_action( 'init', array( $this, 'jetpack_setup' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'jetpack_scripts' ), 10 );
if ( storefront_is_woocommerce_activated() ) {
add_action( 'init', array( $this, 'jetpack_infinite_scroll_wrapper_columns' ) );
@ -36,21 +36,26 @@ if ( ! class_exists( 'Storefront_Jetpack' ) ) :
* See: http://jetpack.me/support/infinite-scroll/
*/
public function jetpack_setup() {
add_theme_support( 'infinite-scroll', apply_filters( 'storefront_jetpack_infinite_scroll_args', array(
'container' => 'main',
'footer' => 'page',
'render' => array( $this, 'jetpack_infinite_scroll_loop' ),
'footer_widgets' => array(
'footer-1',
'footer-2',
'footer-3',
'footer-4',
),
) ) );
add_theme_support(
'infinite-scroll', apply_filters(
'storefront_jetpack_infinite_scroll_args', array(
'container' => 'main',
'footer' => 'page',
'render' => array( $this, 'jetpack_infinite_scroll_loop' ),
'footer_widgets' => array(
'footer-1',
'footer-2',
'footer-3',
'footer-4',
),
)
)
);
}
/**
* A loop used to display content appended using Jetpack infinite scroll
*
* @return void
*/
public function jetpack_infinite_scroll_loop() {
@ -61,7 +66,8 @@ if ( ! class_exists( 'Storefront_Jetpack' ) ) :
woocommerce_product_loop_start();
}
while ( have_posts() ) : the_post();
while ( have_posts() ) :
the_post();
if ( storefront_is_product_archive() ) {
wc_get_template_part( 'content', 'product' );
} else {
@ -79,6 +85,7 @@ if ( ! class_exists( 'Storefront_Jetpack' ) ) :
/**
* Adds columns wrapper to content appended by Jetpack infinite scroll
*
* @return void
*/
public function jetpack_infinite_scroll_wrapper_columns() {

View file

@ -22,12 +22,12 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
* @since 2.2.0
*/
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'admin_notices', array( $this, 'admin_notices' ), 99 );
add_action( 'wp_ajax_storefront_dismiss_notice', array( $this, 'dismiss_nux' ) );
add_action( 'admin_post_storefront_starter_content', array( $this, 'redirect_customizer' ) );
add_action( 'init', array( $this, 'log_fresh_site_state' ) );
add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'admin_notices', array( $this, 'admin_notices' ), 99 );
add_action( 'wp_ajax_storefront_dismiss_notice', array( $this, 'dismiss_nux' ) );
add_action( 'admin_post_storefront_starter_content', array( $this, 'redirect_customizer' ) );
add_action( 'init', array( $this, 'log_fresh_site_state' ) );
add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
}
/**
@ -49,7 +49,7 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
wp_enqueue_script( 'storefront-admin-nux', get_template_directory_uri() . '/assets/js/admin/admin' . $suffix . '.js', array( 'jquery' ), $storefront_version, 'all' );
$storefront_nux = array(
'nonce' => wp_create_nonce( 'storefront_notice_dismiss' )
'nonce' => wp_create_nonce( 'storefront_notice_dismiss' ),
);
wp_localize_script( 'storefront-admin-nux', 'storefrontNUX', $storefront_nux );
@ -93,7 +93,8 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
echo esc_attr__( 'Before you add your first product let\'s design your store. We\'ll add some example products for you. When you\'re ready let\'s get started by adding your logo.', 'storefront' );
} else {
echo esc_attr__( 'You\'ve set up WooCommerce, now it\'s time to give it some style! Let\'s get started by entering the Customizer and adding your logo.', 'storefront' );
} ?>
}
?>
</p>
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post">
<input type="hidden" name="action" value="storefront_starter_content">
@ -111,11 +112,11 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
<label>
<input type="checkbox" name="homepage" checked>
<?php
if ( 'page' === get_option( 'show_on_front' ) ) {
esc_attr_e( 'Apply the Storefront homepage template', 'storefront' );
} else {
esc_attr_e( 'Create a homepage using Storefront\'s homepage template', 'storefront' );
}
if ( 'page' === get_option( 'show_on_front' ) ) {
esc_attr_e( 'Apply the Storefront homepage template', 'storefront' );
} else {
esc_attr_e( 'Create a homepage using Storefront\'s homepage template', 'storefront' );
}
?>
</label>
@ -132,7 +133,8 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
<?php endif; ?>
</div>
</div>
<?php }
<?php
}
/**
* AJAX dismiss notice.
@ -140,9 +142,7 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
* @since 2.2.0
*/
public function dismiss_nux() {
$nonce = ! empty( $_POST['nonce'] ) ? $_POST['nonce'] : false;
if ( ! $nonce || ! wp_verify_nonce( $nonce, 'storefront_notice_dismiss' ) || ! current_user_can( 'manage_options' ) ) {
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['nonce'] ) ), 'storefront_notice_dismiss' ) || ! current_user_can( 'manage_options' ) ) {
die();
}
@ -209,13 +209,15 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
public static function get_woocommerce_pages() {
$woocommerce_pages = array();
$wc_pages_options = apply_filters( 'storefront_page_option_names', array(
'woocommerce_cart_page_id',
'woocommerce_checkout_page_id',
'woocommerce_myaccount_page_id',
'woocommerce_shop_page_id',
'woocommerce_terms_page_id'
) );
$wc_pages_options = apply_filters(
'storefront_page_option_names', array(
'woocommerce_cart_page_id',
'woocommerce_checkout_page_id',
'woocommerce_myaccount_page_id',
'woocommerce_shop_page_id',
'woocommerce_terms_page_id',
)
);
foreach ( $wc_pages_options as $option ) {
$page_id = get_option( $option );
@ -272,10 +274,14 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
if ( ! empty( $plugins ) ) {
$keys = array_keys( $plugins );
$plugin_file = 'woocommerce/' . $keys[0];
$url = wp_nonce_url( add_query_arg( array(
'action' => 'activate',
'plugin' => $plugin_file
), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file );
$url = wp_nonce_url(
add_query_arg(
array(
'action' => 'activate',
'plugin' => $plugin_file,
), admin_url( 'plugins.php' )
), 'activate-plugin_' . $plugin_file
);
return $url;
}
@ -301,9 +307,9 @@ if ( ! class_exists( 'Storefront_NUX_Admin' ) ) :
* Given a page id assign a given page template to it.
*
* @since 2.2.0
* @param int $page_id
* @param string $template
* @return void
* @param int $page_id Page id.
* @param string $template Template file name.
* @return void|bool Returns false if $page_id or $template is empty.
*/
private function _assign_page_template( $page_id, $template ) {
if ( empty( $page_id ) || empty( $template ) || '' === locate_template( $template ) ) {

View file

@ -34,7 +34,7 @@ if ( ! class_exists( 'Storefront_NUX_Guided_Tour' ) ) :
global $pagenow;
if ( 'customize.php' === $pagenow && false === (bool) get_option( 'storefront_nux_guided_tour', false ) ) {
add_action( 'customize_controls_enqueue_scripts', array( $this, 'customize_scripts' ) );
add_action( 'customize_controls_enqueue_scripts', array( $this, 'customize_scripts' ) );
add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_templates' ) );
if ( current_user_can( 'manage_options' ) ) {
@ -106,6 +106,7 @@ if ( ! class_exists( 'Storefront_NUX_Guided_Tour' ) ) :
$steps[] = array(
'title' => __( 'Welcome to the Customizer', 'storefront' ),
/* translators: %s: 'End Of Line' symbol */
'message' => sprintf( __( 'Here you can control the overall look and feel of your store.%sTo get started, let\'s add your logo', 'storefront' ), PHP_EOL . PHP_EOL ),
'button_text' => __( 'Let\'s go!', 'storefront' ),
'section' => '#customize-info',
@ -138,8 +139,9 @@ if ( ! class_exists( 'Storefront_NUX_Guided_Tour' ) ) :
);
$steps[] = array(
'title' => '',
'message' => sprintf( __( 'All set! Remember to %ssave & publish%s your changes when you\'re done.%sYou can return to your dashboard by clicking the X in the top left corner.', 'storefront' ), '<strong>', '</strong>', PHP_EOL . PHP_EOL ),
'title' => '',
/* translators: 1: open <strong> tag, 2: close <strong> tag, 3: 'End Of Line' symbol */
'message' => sprintf( __( 'All set! Remember to %1$ssave & publish%2$s your changes when you\'re done.%3$sYou can return to your dashboard by clicking the X in the top left corner.', 'storefront' ), '<strong>', '</strong>', PHP_EOL . PHP_EOL ),
'section' => '#customize-header-actions .save',
'button_text' => __( 'Done', 'storefront' ),
);

View file

@ -22,15 +22,15 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
* @since 2.2.0
*/
public function __construct() {
add_action( 'after_setup_theme', array( $this, 'starter_content' ) );
add_filter( 'get_theme_starter_content', array( $this, 'filter_start_content' ), 10, 2 );
add_action( 'woocommerce_product_query', array( $this, 'wc_query' ) );
add_action( 'after_setup_theme', array( $this, 'starter_content' ) );
add_filter( 'get_theme_starter_content', array( $this, 'filter_start_content' ), 10, 2 );
add_action( 'woocommerce_product_query', array( $this, 'wc_query' ) );
add_filter( 'woocommerce_shortcode_products_query', array( $this, 'shortcode_loop_products' ), 10, 3 );
add_action( 'customize_preview_init', array( $this, 'add_product_tax' ), 10 );
add_action( 'customize_preview_init', array( $this, 'set_product_data' ), 10 );
add_action( 'after_setup_theme', array( $this, 'remove_default_widgets' ) );
add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
add_filter( 'the_title', array( $this, 'filter_auto_draft_title' ) , 10, 2 );
add_action( 'customize_preview_init', array( $this, 'add_product_tax' ), 10 );
add_action( 'customize_preview_init', array( $this, 'set_product_data' ), 10 );
add_action( 'after_setup_theme', array( $this, 'remove_default_widgets' ) );
add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
add_filter( 'the_title', array( $this, 'filter_auto_draft_title' ), 10, 2 );
}
/**
@ -57,6 +57,7 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
'posts' => array(
'home' => array(
'post_title' => esc_attr__( 'Welcome', 'storefront' ),
/* translators: %s: 'End Of Line' symbol */
'post_content' => sprintf( esc_attr__( 'This is your homepage which is what most visitors will see when they first visit your shop.%sYou can change this text by editing the "Welcome" page via the "Pages" menu in your dashboard.', 'storefront' ), PHP_EOL . PHP_EOL ),
'template' => 'template-homepage.php',
'thumbnail' => '{{hero-image}}',
@ -71,7 +72,7 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
'post_title' => __( 'Contact', 'storefront' ),
'post_content' => __( 'This is a page with some basic contact information, such as an address and phone number. You might also try a plugin to add a contact form.', 'storefront' ),
),
'blog'
'blog',
),
'attachments' => array(
'beanie-image' => array(
@ -146,10 +147,10 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
),
'widgets' => array(
'footer-1' => array(
'text_about'
'text_about',
),
'footer-2' => array(
'text_business_info'
'text_business_info',
),
),
'nav_menus' => array(
@ -249,8 +250,8 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
$tasks = array();
if ( isset( $_GET['sf_tasks'] ) && '' !== sanitize_text_field( $_GET['sf_tasks'] ) ) {
$tasks = explode( ',', sanitize_text_field( $_GET['sf_tasks'] ) );
if ( isset( $_GET['sf_tasks'] ) && '' !== sanitize_text_field( wp_unslash( $_GET['sf_tasks'] ) ) ) {
$tasks = explode( ',', sanitize_text_field( wp_unslash( $_GET['sf_tasks'] ) ) );
}
$tasks = $this->_validate_tasks( $tasks );
@ -347,14 +348,14 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
$query_args['post__in'] = array();
// Add existing products to query
// Add existing products to query.
$existing_products = $this->_get_existing_wc_products();
if ( ! empty( $existing_products ) ) {
$query_args['post__in'] = array_merge( $query_args['post__in'], $existing_products );
}
// Add starter content to query
// Add starter content to query.
$created_products = $this->_get_created_starter_content_products();
if ( false !== $created_products ) {
@ -490,32 +491,32 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
$product_data = $starter_products[ $post_name ]['product_data'];
// Set visibility
// Set visibility.
$product->set_catalog_visibility( 'visible' );
// Set regular price
// Set regular price.
if ( ! empty( $product_data['regular_price'] ) ) {
$product->set_regular_price( floatval( $product_data['regular_price'] ) );
}
// Set price
// Set price.
if ( ! empty( $product_data['price'] ) ) {
$product->set_price( floatval( $product_data['price'] ) );
}
// Set sale price
// Set sale price.
if ( ! empty( $product_data['sale_price'] ) ) {
$product->set_sale_price( floatval( $product_data['sale_price'] ) );
}
// Set featured
// Set featured.
if ( ! empty( $product_data['featured'] ) ) {
$product->set_featured( true );
} else {
$product->set_featured( false );
}
// Save
// Save.
$product->save();
}
}
@ -530,7 +531,12 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
*/
public function filter_sf_categories( $args ) {
// Get Categories.
$product_cats = get_terms( 'product_cat', array( 'fields' => 'ids', 'hide_empty' => false ) );
$product_cats = get_terms(
'product_cat', array(
'fields' => 'ids',
'hide_empty' => false,
)
);
if ( ! empty( $product_cats ) ) {
@ -549,9 +555,9 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
* Here we change the title back when the post status changes.
*
* @since 2.2.0
* @param string $new_status
* @param string $old_status
* @param object $post
* @param string $new_status New status.
* @param string $old_status Old status.
* @param WP_Post $post Post data.
*/
public function transition_post_status( $new_status, $old_status, $post ) {
if ( 'publish' === $new_status && 'auto-draft' === $old_status && in_array( $post->post_type, array( 'product' ) ) ) {
@ -562,7 +568,7 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
if ( $post_name && array_key_exists( $post_name, $starter_products ) ) {
$update_product = array(
'ID' => $post->ID,
'post_title' => $starter_products[ $post_name ]['post_title']
'post_title' => $starter_products[ $post_name ]['post_title'],
);
wp_update_post( $update_product );
@ -575,8 +581,8 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
* Here we filter the title and display the correct one instead.
*
* @since 2.2.0
* @param string $title
* @param int $post_id
* @param string $title Post title.
* @param int $post_id Post id.
*/
public function filter_auto_draft_title( $title, $post_id = null ) {
if ( ! $post_id ) {
@ -614,7 +620,7 @@ if ( ! class_exists( 'Storefront_NUX_Starter_Content' ) ) :
$tshirts_description = esc_attr__( 'A short category description', 'storefront' );
$products = array(
// Accessories
// Accessories.
'beanie' => array(
'post_title' => esc_attr__( 'Beanie', 'storefront' ),
'post_content' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.',

View file

@ -37,7 +37,7 @@ if ( ! function_exists( 'storefront_comment' ) ) {
$add_below = 'div-comment';
}
?>
<<?php echo esc_attr( $tag ); ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ) ?> id="comment-<?php comment_ID() ?>">
<<?php echo esc_attr( $tag ); ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID(); ?>">
<div class="comment-body">
<div class="comment-meta commentmetadata">
<div class="comment-author vcard">
@ -54,20 +54,30 @@ if ( ! function_exists( 'storefront_comment' ) ) {
</a>
</div>
<?php if ( 'div' != $args['style'] ) : ?>
<div id="div-comment-<?php comment_ID() ?>" class="comment-content">
<div id="div-comment-<?php comment_ID(); ?>" class="comment-content">
<?php endif; ?>
<div class="comment-text">
<?php comment_text(); ?>
</div>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
<?php
comment_reply_link(
array_merge(
$args, array(
'add_below' => $add_below,
'depth' => $depth,
'max_depth' => $args['max_depth'],
)
)
);
?>
<?php edit_comment_link( __( 'Edit', 'storefront' ), ' ', '' ); ?>
</div>
</div>
<?php if ( 'div' != $args['style'] ) : ?>
</div>
<?php endif; ?>
<?php
<?php
}
}
@ -86,30 +96,36 @@ if ( ! function_exists( 'storefront_footer_widgets' ) ) {
// Defines the number of active columns in this footer row.
for ( $region = $regions; 0 < $region; $region-- ) {
if ( is_active_sidebar( 'footer-' . strval( $region + $regions * ( $row - 1 ) ) ) ) {
if ( is_active_sidebar( 'footer-' . esc_attr( $region + $regions * ( $row - 1 ) ) ) ) {
$columns = $region;
break;
}
}
if ( isset( $columns ) ) : ?>
<div class=<?php echo '"footer-widgets row-' . strval( $row ) . ' col-' . strval( $columns ) . ' fix"'; ?>><?php
if ( isset( $columns ) ) :
?>
<div class=<?php echo '"footer-widgets row-' . esc_attr( $row ) . ' col-' . esc_attr( $columns ) . ' fix"'; ?>>
<?php
for ( $column = 1; $column <= $columns; $column++ ) :
$footer_n = $column + $regions * ( $row - 1 );
for ( $column = 1; $column <= $columns; $column++ ) :
$footer_n = $column + $regions * ( $row - 1 );
if ( is_active_sidebar( 'footer-' . strval( $footer_n ) ) ) : ?>
if ( is_active_sidebar( 'footer-' . esc_attr( $footer_n ) ) ) :
?>
<div class="block footer-widget-<?php echo strval( $column ); ?>">
<?php dynamic_sidebar( 'footer-' . strval( $footer_n ) ); ?>
</div><?php
<div class="block footer-widget-<?php echo esc_attr( $column ); ?>">
<?php dynamic_sidebar( 'footer-' . esc_attr( $footer_n ) ); ?>
</div>
<?php
endif;
endfor; ?>
endif;
endfor;
?>
</div><!-- .footer-widgets.row-<?php echo strval( $row ); ?> --><?php
</div><!-- .footer-widgets.row-<?php echo esc_attr( $row ); ?> -->
<?php
unset( $columns );
unset( $columns );
endif;
endfor;
}
@ -128,12 +144,12 @@ if ( ! function_exists( 'storefront_credit' ) ) {
<?php echo esc_html( apply_filters( 'storefront_copyright_text', $content = '&copy; ' . get_bloginfo( 'name' ) . ' ' . date( 'Y' ) ) ); ?>
<?php if ( apply_filters( 'storefront_credit_link', true ) ) { ?>
<br />
<?php
<?php
if ( apply_filters( 'storefront_privacy_policy_link', true ) && function_exists( 'the_privacy_policy_link' ) ) {
the_privacy_policy_link( '', '<span role="separator" aria-hidden="true"></span>' );
}
?>
<?php echo '<a href="https://woocommerce.com" target="_blank" title="' . esc_attr__( 'WooCommerce - The Best eCommerce Platform for WordPress', 'storefront' ) . '" rel="author">' . esc_html__( 'Built with Storefront &amp; WooCommerce', 'storefront' ) . '</a>.' ?>
?>
<?php echo '<a href="https://woocommerce.com" target="_blank" title="' . esc_attr__( 'WooCommerce - The Best eCommerce Platform for WordPress', 'storefront' ) . '" rel="author">' . esc_html__( 'Built with Storefront &amp; WooCommerce', 'storefront' ) . '</a>.'; ?>
<?php } ?>
</div><!-- .site-info -->
<?php
@ -148,13 +164,13 @@ if ( ! function_exists( 'storefront_header_widget_region' ) ) {
*/
function storefront_header_widget_region() {
if ( is_active_sidebar( 'header-1' ) ) {
?>
?>
<div class="header-widget-region" role="complementary">
<div class="col-full">
<?php dynamic_sidebar( 'header-1' ); ?>
</div>
</div>
<?php
<?php
}
}
}
@ -190,10 +206,11 @@ if ( ! function_exists( 'storefront_site_title_or_logo' ) ) {
} elseif ( function_exists( 'jetpack_has_site_logo' ) && jetpack_has_site_logo() ) {
// Copied from jetpack_the_site_logo() function.
$logo = site_logo()->logo;
$logo_id = get_theme_mod( 'custom_logo' ); // Check for WP 4.5 Site Logo
$logo_id = get_theme_mod( 'custom_logo' ); // Check for WP 4.5 Site Logo.
$logo_id = $logo_id ? $logo_id : $logo['id']; // Use WP Core logo if present, otherwise use Jetpack's.
$size = site_logo()->theme_size();
$html = sprintf( '<a href="%1$s" class="site-logo-link" rel="home" itemprop="url">%2$s</a>',
$html = sprintf(
'<a href="%1$s" class="site-logo-link" rel="home" itemprop="url">%2$s</a>',
esc_url( home_url( '/' ) ),
wp_get_attachment_image(
$logo_id,
@ -202,7 +219,7 @@ if ( ! function_exists( 'storefront_site_title_or_logo' ) ) {
array(
'class' => 'site-logo attachment-' . $size,
'data-size' => $size,
'itemprop' => 'logo'
'itemprop' => 'logo',
)
)
);
@ -211,7 +228,7 @@ if ( ! function_exists( 'storefront_site_title_or_logo' ) ) {
} else {
$tag = is_home() ? 'h1' : 'div';
$html = '<' . esc_attr( $tag ) . ' class="beta site-title"><a href="' . esc_url( home_url( '/' ) ) . '" rel="home">' . esc_html( get_bloginfo( 'name' ) ) . '</a></' . esc_attr( $tag ) .'>';
$html = '<' . esc_attr( $tag ) . ' class="beta site-title"><a href="' . esc_url( home_url( '/' ) ) . '" rel="home">' . esc_html( get_bloginfo( 'name' ) ) . '</a></' . esc_attr( $tag ) . '>';
if ( '' !== get_bloginfo( 'description' ) ) {
$html .= '<p class="site-description">' . esc_html( get_bloginfo( 'description', 'display' ) ) . '</p>';
@ -222,7 +239,7 @@ if ( ! function_exists( 'storefront_site_title_or_logo' ) ) {
return $html;
}
echo $html;
echo $html; // WPCS: XSS ok.
}
}
@ -240,16 +257,16 @@ if ( ! function_exists( 'storefront_primary_navigation' ) ) {
<?php
wp_nav_menu(
array(
'theme_location' => 'primary',
'container_class' => 'primary-navigation',
)
'theme_location' => 'primary',
'container_class' => 'primary-navigation',
)
);
wp_nav_menu(
array(
'theme_location' => 'handheld',
'container_class' => 'handheld-navigation',
)
'theme_location' => 'handheld',
'container_class' => 'handheld-navigation',
)
);
?>
</nav><!-- #site-navigation -->
@ -265,19 +282,19 @@ if ( ! function_exists( 'storefront_secondary_navigation' ) ) {
* @return void
*/
function storefront_secondary_navigation() {
if ( has_nav_menu( 'secondary' ) ) {
?>
<nav class="secondary-navigation" role="navigation" aria-label="<?php esc_html_e( 'Secondary Navigation', 'storefront' ); ?>">
<?php
wp_nav_menu(
array(
'theme_location' => 'secondary',
'fallback_cb' => '',
)
);
?>
</nav><!-- #site-navigation -->
<?php
if ( has_nav_menu( 'secondary' ) ) {
?>
<nav class="secondary-navigation" role="navigation" aria-label="<?php esc_html_e( 'Secondary Navigation', 'storefront' ); ?>">
<?php
wp_nav_menu(
array(
'theme_location' => 'secondary',
'fallback_cb' => '',
)
);
?>
</nav><!-- #site-navigation -->
<?php
}
}
}
@ -344,10 +361,12 @@ if ( ! function_exists( 'storefront_page_content' ) ) {
<div class="entry-content">
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
'after' => '</div>',
) );
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->
<?php
@ -400,6 +419,7 @@ if ( ! function_exists( 'storefront_post_content' ) ) {
the_content(
sprintf(
/* translators: %s: post title */
__( 'Continue reading %s', 'storefront' ),
'<span class="screen-reader-text">' . get_the_title() . '</span>'
)
@ -407,10 +427,12 @@ if ( ! function_exists( 'storefront_post_content' ) ) {
do_action( 'storefront_post_content_after' );
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
'after' => '</div>',
) );
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
'after' => '</div>',
)
);
?>
</div><!-- .entry-content -->
<?php
@ -426,9 +448,10 @@ if ( ! function_exists( 'storefront_post_meta' ) ) {
function storefront_post_meta() {
?>
<aside class="entry-meta">
<?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search.
<?php
if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search.
?>
?>
<div class="vcard author">
<?php
echo get_avatar( get_the_author_meta( 'ID' ), 128 );
@ -436,31 +459,33 @@ if ( ! function_exists( 'storefront_post_meta' ) ) {
echo sprintf( '<a href="%1$s" class="url fn" rel="author">%2$s</a>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() );
?>
</div>
<?php
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'storefront' ) );
<?php
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'storefront' ) );
if ( $categories_list ) : ?>
if ( $categories_list ) :
?>
<div class="cat-links">
<?php
echo '<div class="label">' . esc_attr( __( 'Posted in', 'storefront' ) ) . '</div>';
echo wp_kses_post( $categories_list );
?>
<?php
echo '<div class="label">' . esc_attr( __( 'Posted in', 'storefront' ) ) . '</div>';
echo wp_kses_post( $categories_list );
?>
</div>
<?php endif; // End if categories. ?>
<?php endif; // End if categories. ?>
<?php
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', __( ', ', 'storefront' ) );
<?php
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', __( ', ', 'storefront' ) );
if ( $tags_list ) : ?>
if ( $tags_list ) :
?>
<div class="tags-links">
<?php
echo '<div class="label">' . esc_attr( __( 'Tagged', 'storefront' ) ) . '</div>';
echo wp_kses_post( $tags_list );
?>
<?php
echo '<div class="label">' . esc_attr( __( 'Tagged', 'storefront' ) ) . '</div>';
echo wp_kses_post( $tags_list );
?>
</div>
<?php endif; // End if $tags_list. ?>
<?php endif; // End if $tags_list. ?>
<?php endif; // End if 'post' == get_post_type(). ?>
@ -483,10 +508,10 @@ if ( ! function_exists( 'storefront_paging_nav' ) ) {
global $wp_query;
$args = array(
'type' => 'list',
'type' => 'list',
'next_text' => _x( 'Next', 'Next post', 'storefront' ),
'prev_text' => _x( 'Previous', 'Previous post', 'storefront' ),
);
);
the_posts_pagination( $args );
}
@ -500,7 +525,7 @@ if ( ! function_exists( 'storefront_post_nav' ) ) {
$args = array(
'next_text' => '<span class="screen-reader-text">' . esc_html__( 'Next post:', 'storefront' ) . ' </span>%title',
'prev_text' => '<span class="screen-reader-text">' . esc_html__( 'Previous post:', 'storefront' ) . ' </span>%title',
);
);
the_post_navigation( $args );
}
}
@ -515,7 +540,8 @@ if ( ! function_exists( 'storefront_posted_on' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time> <time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
@ -523,24 +549,27 @@ if ( ! function_exists( 'storefront_posted_on' ) ) {
);
$posted_on = sprintf(
/* translators: %s: post date */
_x( 'Posted on %s', 'post date', 'storefront' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);
echo wp_kses( apply_filters( 'storefront_single_post_posted_on_html', '<span class="posted-on">' . $posted_on . '</span>', $posted_on ), array(
'span' => array(
'class' => array(),
),
'a' => array(
'href' => array(),
'title' => array(),
'rel' => array(),
),
'time' => array(
'datetime' => array(),
'class' => array(),
),
) );
echo wp_kses(
apply_filters( 'storefront_single_post_posted_on_html', '<span class="posted-on">' . $posted_on . '</span>', $posted_on ), array(
'span' => array(
'class' => array(),
),
'a' => array(
'href' => array(),
'title' => array(),
'rel' => array(),
),
'time' => array(
'datetime' => array(),
'class' => array(),
),
)
);
}
}

View file

@ -12,7 +12,7 @@
* @see storefront_get_sidebar()
*/
add_action( 'storefront_before_content', 'storefront_header_widget_region', 10 );
add_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );
add_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );
/**
* Header
@ -22,13 +22,13 @@ add_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 )
* @see storefront_site_branding()
* @see storefront_primary_navigation()
*/
add_action( 'storefront_header', 'storefront_header_container', 0 );
add_action( 'storefront_header', 'storefront_skip_links', 5 );
add_action( 'storefront_header', 'storefront_site_branding', 20 );
add_action( 'storefront_header', 'storefront_secondary_navigation', 30 );
add_action( 'storefront_header', 'storefront_header_container_close', 41 );
add_action( 'storefront_header', 'storefront_primary_navigation_wrapper', 42 );
add_action( 'storefront_header', 'storefront_primary_navigation', 50 );
add_action( 'storefront_header', 'storefront_header_container', 0 );
add_action( 'storefront_header', 'storefront_skip_links', 5 );
add_action( 'storefront_header', 'storefront_site_branding', 20 );
add_action( 'storefront_header', 'storefront_secondary_navigation', 30 );
add_action( 'storefront_header', 'storefront_header_container_close', 41 );
add_action( 'storefront_header', 'storefront_primary_navigation_wrapper', 42 );
add_action( 'storefront_header', 'storefront_primary_navigation', 50 );
add_action( 'storefront_header', 'storefront_primary_navigation_wrapper_close', 68 );
/**
@ -38,7 +38,7 @@ add_action( 'storefront_header', 'storefront_primary_navigation_wrapper_close',
* @see storefront_credit()
*/
add_action( 'storefront_footer', 'storefront_footer_widgets', 10 );
add_action( 'storefront_footer', 'storefront_credit', 20 );
add_action( 'storefront_footer', 'storefront_credit', 20 );
/**
* Homepage
@ -58,16 +58,16 @@ add_action( 'homepage', 'storefront_homepage_content', 10 );
* @see storefront_post_nav()
* @see storefront_display_comments()
*/
add_action( 'storefront_loop_post', 'storefront_post_header', 10 );
add_action( 'storefront_loop_post', 'storefront_post_meta', 20 );
add_action( 'storefront_loop_post', 'storefront_post_content', 30 );
add_action( 'storefront_loop_after', 'storefront_paging_nav', 10 );
add_action( 'storefront_single_post', 'storefront_post_header', 10 );
add_action( 'storefront_single_post', 'storefront_post_meta', 20 );
add_action( 'storefront_single_post', 'storefront_post_content', 30 );
add_action( 'storefront_single_post_bottom', 'storefront_post_nav', 10 );
add_action( 'storefront_single_post_bottom', 'storefront_display_comments', 20 );
add_action( 'storefront_post_content_before', 'storefront_post_thumbnail', 10 );
add_action( 'storefront_loop_post', 'storefront_post_header', 10 );
add_action( 'storefront_loop_post', 'storefront_post_meta', 20 );
add_action( 'storefront_loop_post', 'storefront_post_content', 30 );
add_action( 'storefront_loop_after', 'storefront_paging_nav', 10 );
add_action( 'storefront_single_post', 'storefront_post_header', 10 );
add_action( 'storefront_single_post', 'storefront_post_meta', 20 );
add_action( 'storefront_single_post', 'storefront_post_content', 30 );
add_action( 'storefront_single_post_bottom', 'storefront_post_nav', 10 );
add_action( 'storefront_single_post_bottom', 'storefront_display_comments', 20 );
add_action( 'storefront_post_content_before', 'storefront_post_thumbnail', 10 );
/**
* Pages
@ -76,8 +76,8 @@ add_action( 'storefront_post_content_before', 'storefront_post_thumbnail', 10
* @see storefront_page_content()
* @see storefront_display_comments()
*/
add_action( 'storefront_page', 'storefront_page_header', 10 );
add_action( 'storefront_page', 'storefront_page_content', 20 );
add_action( 'storefront_page', 'storefront_page_header', 10 );
add_action( 'storefront_page', 'storefront_page_content', 20 );
add_action( 'storefront_page_after', 'storefront_display_comments', 10 );
/**
@ -87,4 +87,4 @@ add_action( 'storefront_page_after', 'storefront_display_comments', 10 );
* @see storefront_page_content()
*/
add_action( 'storefront_homepage', 'storefront_homepage_header', 10 );
add_action( 'storefront_homepage', 'storefront_page_content', 20 );
add_action( 'storefront_homepage', 'storefront_page_content', 20 );

View file

@ -27,7 +27,7 @@ if ( ! class_exists( 'Storefront_WooCommerce_Customizer' ) ) :
add_action( 'customize_register', array( $this, 'customize_register' ), 10 );
add_action( 'wp_enqueue_scripts', array( $this, 'add_customizer_css' ), 130 );
add_action( 'customize_register', array( $this, 'edit_default_customizer_settings' ), 99 );
add_action( 'init', array( $this, 'default_theme_mod_values' ), 10 );
add_action( 'init', array( $this, 'default_theme_mod_values' ), 10 );
}
/**
@ -37,10 +37,12 @@ if ( ! class_exists( 'Storefront_WooCommerce_Customizer' ) ) :
* @return array
*/
public static function get_storefront_default_setting_values() {
return apply_filters( 'storefront_woocommerce_setting_default_values', $args = array(
'storefront_sticky_add_to_cart' => true,
'storefront_product_pagination' => true,
) );
return apply_filters(
'storefront_woocommerce_setting_default_values', $args = array(
'storefront_sticky_add_to_cart' => true,
'storefront_product_pagination' => true,
)
);
}
/**
@ -54,36 +56,46 @@ if ( ! class_exists( 'Storefront_WooCommerce_Customizer' ) ) :
/**
* Product Page
*/
$wp_customize->add_section( 'storefront_single_product_page' , array(
'title' => __( 'Product Page', 'storefront' ),
'priority' => 60,
) );
$wp_customize->add_section(
'storefront_single_product_page', array(
'title' => __( 'Product Page', 'storefront' ),
'priority' => 60,
)
);
$wp_customize->add_setting( 'storefront_product_pagination', array(
'default' => apply_filters( 'storefront_default_product_pagination', true ),
'sanitize_callback' => 'wp_validate_boolean',
) );
$wp_customize->add_setting(
'storefront_product_pagination', array(
'default' => apply_filters( 'storefront_default_product_pagination', true ),
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_setting( 'storefront_sticky_add_to_cart', array(
'default' => apply_filters( 'storefront_default_sticky_add_to_cart', true ),
'sanitize_callback' => 'wp_validate_boolean',
) );
$wp_customize->add_setting(
'storefront_sticky_add_to_cart', array(
'default' => apply_filters( 'storefront_default_sticky_add_to_cart', true ),
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control( 'storefront_sticky_add_to_cart', array(
'type' => 'checkbox',
'section' => 'storefront_single_product_page',
'label' => __( 'Sticky Add-To-Cart', 'storefront' ),
'description' => __( 'A small content bar at the top of the browser window which includes relevant product information and an add-to-cart button. It slides into view once the standard add-to-cart button has scrolled out of view.', 'storefront' ),
'priority' => 10,
) );
$wp_customize->add_control(
'storefront_sticky_add_to_cart', array(
'type' => 'checkbox',
'section' => 'storefront_single_product_page',
'label' => __( 'Sticky Add-To-Cart', 'storefront' ),
'description' => __( 'A small content bar at the top of the browser window which includes relevant product information and an add-to-cart button. It slides into view once the standard add-to-cart button has scrolled out of view.', 'storefront' ),
'priority' => 10,
)
);
$wp_customize->add_control( 'storefront_product_pagination', array(
'type' => 'checkbox',
'section' => 'storefront_single_product_page',
'label' => __( 'Product Pagination', 'storefront' ),
'description' => __( 'Displays next and previous links on product pages. A product thumbnail is displayed with the title revealed on hover.', 'storefront' ),
'priority' => 20,
) );
$wp_customize->add_control(
'storefront_product_pagination', array(
'type' => 'checkbox',
'section' => 'storefront_single_product_page',
'label' => __( 'Product Pagination', 'storefront' ),
'description' => __( 'Displays next and previous links on product pages. A product thumbnail is displayed with the title revealed on hover.', 'storefront' ),
'priority' => 20,
)
);
}
/**

View file

@ -23,25 +23,25 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
* @since 1.0
*/
public function __construct() {
add_action( 'after_setup_theme', array( $this, 'setup' ) );
add_filter( 'body_class', array( $this, 'woocommerce_body_class' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'woocommerce_scripts' ), 20 );
add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );
add_action( 'after_setup_theme', array( $this, 'setup' ) );
add_filter( 'body_class', array( $this, 'woocommerce_body_class' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'woocommerce_scripts' ), 20 );
add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );
add_filter( 'woocommerce_output_related_products_args', array( $this, 'related_products_args' ) );
add_filter( 'woocommerce_product_thumbnails_columns', array( $this, 'thumbnail_columns' ) );
add_filter( 'woocommerce_breadcrumb_defaults', array( $this,'change_breadcrumb_delimiter' ) );
add_filter( 'woocommerce_product_thumbnails_columns', array( $this, 'thumbnail_columns' ) );
add_filter( 'woocommerce_breadcrumb_defaults', array( $this, 'change_breadcrumb_delimiter' ) );
if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.5', '<' ) ) {
add_action( 'wp_footer', array( $this, 'star_rating_script' ) );
add_action( 'wp_footer', array( $this, 'star_rating_script' ) );
}
if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '3.3', '<' ) ) {
add_filter( 'loop_shop_per_page', array( $this, 'products_per_page' ) );
add_filter( 'loop_shop_per_page', array( $this, 'products_per_page' ) );
}
// Integrations.
add_action( 'wp_enqueue_scripts', array( $this, 'woocommerce_integrations_scripts' ), 99 );
add_action( 'wp_enqueue_scripts', array( $this, 'add_customizer_css' ), 140 );
add_action( 'wp_enqueue_scripts', array( $this, 'woocommerce_integrations_scripts' ), 99 );
add_action( 'wp_enqueue_scripts', array( $this, 'add_customizer_css' ), 140 );
}
/**
@ -55,17 +55,21 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
* @return void
*/
public function setup() {
add_theme_support( 'woocommerce', apply_filters( 'storefront_woocommerce_args', array(
'single_image_width' => 416,
'thumbnail_image_width' => 324,
'product_grid' => array(
'default_columns' => 3,
'default_rows' => 4,
'min_columns' => 1,
'max_columns' => 6,
'min_rows' => 1
add_theme_support(
'woocommerce', apply_filters(
'storefront_woocommerce_args', array(
'single_image_width' => 416,
'thumbnail_image_width' => 324,
'product_grid' => array(
'default_columns' => 3,
'default_rows' => 4,
'min_columns' => 1,
'max_columns' => 6,
'min_rows' => 1,
),
)
)
) ) );
);
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
@ -107,8 +111,10 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
public function woocommerce_body_class( $classes ) {
$classes[] = 'woocommerce-active';
// Remove `no-wc-breadcrumb` body class
if ( false !== $key = array_search( 'no-wc-breadcrumb', $classes ) ) {
// Remove `no-wc-breadcrumb` body class.
$key = array_search( 'no-wc-breadcrumb', $classes );
if ( false !== $key ) {
unset( $classes[ $key ] );
}
@ -148,7 +154,7 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
*/
public function star_rating_script() {
if ( is_product() ) {
?>
?>
<script type="text/javascript">
var starsEl = document.querySelector( '#respond p.stars' );
if ( starsEl ) {
@ -159,7 +165,7 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
} );
}
</script>
<?php
<?php
}
}
@ -171,10 +177,12 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
* @return array $args related products args
*/
public function related_products_args( $args ) {
$args = apply_filters( 'storefront_related_products_args', array(
'posts_per_page' => 3,
'columns' => 3,
) );
$args = apply_filters(
'storefront_related_products_args', array(
'posts_per_page' => 3,
'columns' => 3,
)
);
return $args;
}
@ -217,8 +225,9 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
/**
* Remove the breadcrumb delimiter
* @param array $defaults The breadcrumb defaults
* @return array The breadcrumb defaults
*
* @param array $defaults The breadcrumb defaults.
* @return array The breadcrumb defaults.
* @since 2.2.0
*/
public function change_breadcrumb_delimiter( $defaults ) {
@ -386,10 +395,10 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
$storefront_customizer = new Storefront_Customizer();
$storefront_theme_mods = $storefront_customizer->get_storefront_theme_mods();
$woocommerce_extension_style = '';
$woocommerce_extension_style = '';
if ( $this->is_woocommerce_extension_activated( 'WC_Bookings' ) ) {
$woocommerce_extension_style .= '
$woocommerce_extension_style .= '
.wc-bookings-date-picker .ui-datepicker td.bookable a {
background-color: ' . $storefront_theme_mods['accent_color'] . ' !important;
}
@ -405,7 +414,7 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
}
if ( $this->is_woocommerce_extension_activated( 'WC_Product_Reviews_Pro' ) ) {
$woocommerce_extension_style .= '
$woocommerce_extension_style .= '
.woocommerce #reviews .product-rating .product-rating-details table td.rating-graph .bar,
.woocommerce-page #reviews .product-rating .product-rating-details table td.rating-graph .bar {
background-color: ' . $storefront_theme_mods['text_color'] . ' !important;
@ -431,7 +440,7 @@ if ( ! class_exists( 'Storefront_WooCommerce' ) ) :
}
if ( $this->is_woocommerce_extension_activated( 'WC_Smart_Coupons' ) ) {
$woocommerce_extension_style .= '
$woocommerce_extension_style .= '
.coupon-container {
background-color: ' . $storefront_theme_mods['button_background_color'] . ' !important;
}

View file

@ -34,7 +34,8 @@ if ( ! function_exists( 'storefront_after_content' ) ) {
</main><!-- #main -->
</div><!-- #primary -->
<?php do_action( 'storefront_sidebar' );
<?php
do_action( 'storefront_sidebar' );
}
}
@ -72,7 +73,8 @@ if ( ! function_exists( 'storefront_cart_link' ) ) {
function storefront_cart_link() {
?>
<a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', 'storefront' ); ?>">
<?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) );?></span>
<?php /* translators: %d: number of items in cart */ ?>
<?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) ); ?></span>
</a>
<?php
}
@ -87,11 +89,12 @@ if ( ! function_exists( 'storefront_product_search' ) ) {
* @return void
*/
function storefront_product_search() {
if ( storefront_is_woocommerce_activated() ) { ?>
if ( storefront_is_woocommerce_activated() ) {
?>
<div class="site-search">
<?php the_widget( 'WC_Widget_Product_Search', 'title=' ); ?>
</div>
<?php
<?php
}
}
}
@ -111,7 +114,7 @@ if ( ! function_exists( 'storefront_header_cart' ) ) {
} else {
$class = '';
}
?>
?>
<ul id="site-header-cart" class="site-header-cart menu">
<li class="<?php echo esc_attr( $class ); ?>">
<?php storefront_cart_link(); ?>
@ -120,7 +123,7 @@ if ( ! function_exists( 'storefront_header_cart' ) ) {
<?php the_widget( 'WC_Widget_Cart', 'title=' ); ?>
</li>
</ul>
<?php
<?php
}
}
}
@ -247,20 +250,26 @@ if ( ! function_exists( 'storefront_product_categories' ) ) {
* @return void
*/
function storefront_product_categories( $args ) {
$args = apply_filters( 'storefront_product_categories_args', array(
'limit' => 3,
'columns' => 3,
'child_categories' => 0,
'orderby' => 'name',
'title' => __( 'Shop by Category', 'storefront' ),
) );
$args = apply_filters(
'storefront_product_categories_args', array(
'limit' => 3,
'columns' => 3,
'child_categories' => 0,
'orderby' => 'name',
'title' => __( 'Shop by Category', 'storefront' ),
)
);
$shortcode_content = storefront_do_shortcode( 'product_categories', apply_filters( 'storefront_product_categories_shortcode_args', array(
'number' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'parent' => esc_attr( $args['child_categories'] ),
) ) );
$shortcode_content = storefront_do_shortcode(
'product_categories', apply_filters(
'storefront_product_categories_shortcode_args', array(
'number' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'parent' => esc_attr( $args['child_categories'] ),
)
)
);
/**
* Only display the section if the shortcode returns product categories
@ -274,7 +283,7 @@ if ( ! function_exists( 'storefront_product_categories' ) ) {
do_action( 'storefront_homepage_after_product_categories_title' );
echo $shortcode_content;
echo $shortcode_content; // WPCS: XSS ok.
do_action( 'storefront_homepage_after_product_categories' );
@ -293,20 +302,26 @@ if ( ! function_exists( 'storefront_recent_products' ) ) {
* @return void
*/
function storefront_recent_products( $args ) {
$args = apply_filters( 'storefront_recent_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'date',
'order' => 'desc',
'title' => __( 'New In', 'storefront' ),
) );
$args = apply_filters(
'storefront_recent_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'date',
'order' => 'desc',
'title' => __( 'New In', 'storefront' ),
)
);
$shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_recent_products_shortcode_args', array(
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
) ) );
$shortcode_content = storefront_do_shortcode(
'products', apply_filters(
'storefront_recent_products_shortcode_args', array(
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
)
)
);
/**
* Only display the section if the shortcode returns products
@ -320,7 +335,7 @@ if ( ! function_exists( 'storefront_recent_products' ) ) {
do_action( 'storefront_homepage_after_recent_products_title' );
echo $shortcode_content;
echo $shortcode_content; // WPCS: XSS ok.
do_action( 'storefront_homepage_after_recent_products' );
@ -339,22 +354,28 @@ if ( ! function_exists( 'storefront_featured_products' ) ) {
* @return void
*/
function storefront_featured_products( $args ) {
$args = apply_filters( 'storefront_featured_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'date',
'order' => 'desc',
'visibility' => 'featured',
'title' => __( 'We Recommend', 'storefront' ),
) );
$args = apply_filters(
'storefront_featured_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'date',
'order' => 'desc',
'visibility' => 'featured',
'title' => __( 'We Recommend', 'storefront' ),
)
);
$shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_featured_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
'visibility' => esc_attr( $args['visibility'] ),
) ) );
$shortcode_content = storefront_do_shortcode(
'products', apply_filters(
'storefront_featured_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
'visibility' => esc_attr( $args['visibility'] ),
)
)
);
/**
* Only display the section if the shortcode returns products
@ -368,7 +389,7 @@ if ( ! function_exists( 'storefront_featured_products' ) ) {
do_action( 'storefront_homepage_after_featured_products_title' );
echo $shortcode_content;
echo $shortcode_content; // WPCS: XSS ok.
do_action( 'storefront_homepage_after_featured_products' );
@ -387,20 +408,26 @@ if ( ! function_exists( 'storefront_popular_products' ) ) {
* @return void
*/
function storefront_popular_products( $args ) {
$args = apply_filters( 'storefront_popular_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'rating',
'order' => 'desc',
'title' => __( 'Fan Favorites', 'storefront' ),
) );
$args = apply_filters(
'storefront_popular_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'rating',
'order' => 'desc',
'title' => __( 'Fan Favorites', 'storefront' ),
)
);
$shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_popular_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
) ) );
$shortcode_content = storefront_do_shortcode(
'products', apply_filters(
'storefront_popular_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
)
)
);
/**
* Only display the section if the shortcode returns products
@ -414,7 +441,7 @@ if ( ! function_exists( 'storefront_popular_products' ) ) {
do_action( 'storefront_homepage_after_popular_products_title' );
echo $shortcode_content;
echo $shortcode_content; // WPCS: XSS ok.
do_action( 'storefront_homepage_after_popular_products' );
@ -433,22 +460,28 @@ if ( ! function_exists( 'storefront_on_sale_products' ) ) {
* @return void
*/
function storefront_on_sale_products( $args ) {
$args = apply_filters( 'storefront_on_sale_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'date',
'order' => 'desc',
'on_sale' => 'true',
'title' => __( 'On Sale', 'storefront' ),
) );
$args = apply_filters(
'storefront_on_sale_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'date',
'order' => 'desc',
'on_sale' => 'true',
'title' => __( 'On Sale', 'storefront' ),
)
);
$shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_on_sale_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
'on_sale' => esc_attr( $args['on_sale'] ),
) ) );
$shortcode_content = storefront_do_shortcode(
'products', apply_filters(
'storefront_on_sale_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
'on_sale' => esc_attr( $args['on_sale'] ),
)
)
);
/**
* Only display the section if the shortcode returns products
@ -462,7 +495,7 @@ if ( ! function_exists( 'storefront_on_sale_products' ) ) {
do_action( 'storefront_homepage_after_on_sale_products_title' );
echo $shortcode_content;
echo $shortcode_content; // WPCS: XSS ok.
do_action( 'storefront_homepage_after_on_sale_products' );
@ -481,20 +514,26 @@ if ( ! function_exists( 'storefront_best_selling_products' ) ) {
* @return void
*/
function storefront_best_selling_products( $args ) {
$args = apply_filters( 'storefront_best_selling_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'popularity',
'order' => 'desc',
'title' => esc_attr__( 'Best Sellers', 'storefront' ),
) );
$args = apply_filters(
'storefront_best_selling_products_args', array(
'limit' => 4,
'columns' => 4,
'orderby' => 'popularity',
'order' => 'desc',
'title' => esc_attr__( 'Best Sellers', 'storefront' ),
)
);
$shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_best_selling_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
) ) );
$shortcode_content = storefront_do_shortcode(
'products', apply_filters(
'storefront_best_selling_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
)
)
);
/**
* Only display the section if the shortcode returns products
@ -508,7 +547,7 @@ if ( ! function_exists( 'storefront_best_selling_products' ) ) {
do_action( 'storefront_homepage_after_best_selling_products_title' );
echo $shortcode_content;
echo $shortcode_content; // WPCS: XSS ok.
do_action( 'storefront_homepage_after_best_selling_products' );
@ -540,26 +579,32 @@ if ( ! function_exists( 'storefront_promoted_products' ) ) {
echo '<h2>' . esc_html__( 'Featured Products', 'storefront' ) . '</h2>';
echo storefront_do_shortcode( 'featured_products', array(
'per_page' => $per_page,
'columns' => $columns,
) );
echo storefront_do_shortcode(
'featured_products', array(
'per_page' => $per_page,
'columns' => $columns,
)
); // WPCS: XSS ok.
} elseif ( wc_get_product_ids_on_sale() ) {
echo '<h2>' . esc_html__( 'On Sale Now', 'storefront' ) . '</h2>';
echo storefront_do_shortcode( 'sale_products', array(
'per_page' => $per_page,
'columns' => $columns,
) );
echo storefront_do_shortcode(
'sale_products', array(
'per_page' => $per_page,
'columns' => $columns,
)
); // WPCS: XSS ok.
} elseif ( $recent_fallback ) {
echo '<h2>' . esc_html__( 'New In Store', 'storefront' ) . '</h2>';
echo storefront_do_shortcode( 'recent_products', array(
'per_page' => $per_page,
'columns' => $columns,
) );
echo storefront_do_shortcode(
'recent_products', array(
'per_page' => $per_page,
'columns' => $columns,
)
); // WPCS: XSS ok.
}
}
}
@ -635,7 +680,7 @@ if ( ! function_exists( 'storefront_handheld_footer_bar_cart_link' ) ) {
function storefront_handheld_footer_bar_cart_link() {
?>
<a class="footer-cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', 'storefront' ); ?>">
<span class="count"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() );?></span>
<span class="count"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() ); ?></span>
</a>
<?php
}
@ -666,7 +711,7 @@ if ( ! function_exists( 'storefront_single_product_pagination' ) ) {
// Show only products in the same category?
$same_category = apply_filters( 'storefront_single_product_pagination_same_category', false );
// Get previous and next products
// Get previous and next products.
$previous_product = get_previous_post( $same_category );
$next_product = get_next_post( $same_category );
@ -713,9 +758,11 @@ if ( ! function_exists( 'storefront_sticky_single_add_to_cart' ) ) {
return;
}
$params = apply_filters( 'storefront_sticky_add_to_cart_params', array(
'trigger_class' => 'entry-summary'
) );
$params = apply_filters(
'storefront_sticky_add_to_cart_params', array(
'trigger_class' => 'entry-summary',
)
);
wp_localize_script( 'storefront-sticky-add-to-cart', 'storefront_sticky_add_to_cart_params', $params );
@ -755,20 +802,26 @@ if ( ! function_exists( 'storefront_woocommerce_brands_homepage_section' ) ) {
* @return void
*/
function storefront_woocommerce_brands_homepage_section() {
$args = apply_filters( 'storefront_woocommerce_brands_args', array(
'number' => 6,
'columns' => 4,
'orderby' => 'name',
'show_empty' => false,
'title' => __( 'Shop by Brand', 'storefront' ),
) );
$args = apply_filters(
'storefront_woocommerce_brands_args', array(
'number' => 6,
'columns' => 4,
'orderby' => 'name',
'show_empty' => false,
'title' => __( 'Shop by Brand', 'storefront' ),
)
);
$shortcode_content = storefront_do_shortcode( 'product_brand_thumbnails', apply_filters( 'storefront_woocommerce_brands_shortcode_args', array(
'number' => absint( $args['number'] ),
'columns' => absint( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'show_empty' => (bool) $args['show_empty'],
) ) );
$shortcode_content = storefront_do_shortcode(
'product_brand_thumbnails', apply_filters(
'storefront_woocommerce_brands_shortcode_args', array(
'number' => absint( $args['number'] ),
'columns' => absint( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'show_empty' => (bool) $args['show_empty'],
)
)
);
echo '<section class="storefront-product-section storefront-woocommerce-brands" aria-label="' . esc_attr__( 'Product Brands', 'storefront' ) . '">';
@ -778,7 +831,7 @@ if ( ! function_exists( 'storefront_woocommerce_brands_homepage_section' ) ) {
do_action( 'storefront_homepage_after_woocommerce_brands_title' );
echo $shortcode_content;
echo $shortcode_content; // WPCS: XSS ok.
do_action( 'storefront_homepage_after_woocommerce_brands' );
@ -818,9 +871,11 @@ if ( ! function_exists( 'storefront_woocommerce_brands_single' ) ) {
* @return void
*/
function storefront_woocommerce_brands_single() {
$brand = storefront_do_shortcode( 'product_brand', array(
'class' => ''
) );
$brand = storefront_do_shortcode(
'product_brand', array(
'class' => '',
)
);
if ( empty( $brand ) ) {
return;

View file

@ -15,11 +15,11 @@
* @see storefront_on_sale_products()
* @see storefront_best_selling_products()
*/
add_action( 'homepage', 'storefront_product_categories', 20 );
add_action( 'homepage', 'storefront_recent_products', 30 );
add_action( 'homepage', 'storefront_featured_products', 40 );
add_action( 'homepage', 'storefront_popular_products', 50 );
add_action( 'homepage', 'storefront_on_sale_products', 60 );
add_action( 'homepage', 'storefront_product_categories', 20 );
add_action( 'homepage', 'storefront_recent_products', 30 );
add_action( 'homepage', 'storefront_featured_products', 40 );
add_action( 'homepage', 'storefront_popular_products', 50 );
add_action( 'homepage', 'storefront_on_sale_products', 60 );
add_action( 'homepage', 'storefront_best_selling_products', 70 );
/**
@ -30,31 +30,31 @@ add_action( 'homepage', 'storefront_best_selling_products', 70 );
* @see woocommerce_breadcrumb()
* @see storefront_shop_messages()
*/
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
add_action( 'woocommerce_before_main_content', 'storefront_before_content', 10 );
add_action( 'woocommerce_after_main_content', 'storefront_after_content', 10 );
add_action( 'storefront_content_top', 'storefront_shop_messages', 15 );
add_action( 'storefront_before_content', 'woocommerce_breadcrumb', 10 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
add_action( 'woocommerce_before_main_content', 'storefront_before_content', 10 );
add_action( 'woocommerce_after_main_content', 'storefront_after_content', 10 );
add_action( 'storefront_content_top', 'storefront_shop_messages', 15 );
add_action( 'storefront_before_content', 'woocommerce_breadcrumb', 10 );
add_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper', 9 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 );
add_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper_close', 31 );
add_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper', 9 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 );
add_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper_close', 31 );
add_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper', 9 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
add_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 );
add_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper_close', 31 );
add_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper', 9 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
add_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 );
add_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper_close', 31 );
add_action( 'storefront_footer', 'storefront_handheld_footer_bar', 999 );
add_action( 'storefront_footer', 'storefront_handheld_footer_bar', 999 );
// Legacy WooCommerce columns filter.
if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '3.3', '<' ) ) {
@ -68,14 +68,14 @@ if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '3.3', '<' ) ) {
*
* @see storefront_upsell_display()
*/
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
add_action( 'woocommerce_after_single_product_summary', 'storefront_upsell_display', 15 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
add_action( 'woocommerce_after_single_product_summary', 'storefront_upsell_display', 15 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 6 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 6 );
add_action( 'woocommerce_after_single_product_summary', 'storefront_single_product_pagination', 30 );
add_action( 'storefront_after_footer', 'storefront_sticky_single_add_to_cart', 999 );
add_action( 'woocommerce_after_single_product_summary', 'storefront_single_product_pagination', 30 );
add_action( 'storefront_after_footer', 'storefront_sticky_single_add_to_cart', 999 );
/**
* Header
@ -84,7 +84,7 @@ add_action( 'storefront_after_footer', 'storefront_sticky_si
* @see storefront_header_cart()
*/
add_action( 'storefront_header', 'storefront_product_search', 40 );
add_action( 'storefront_header', 'storefront_header_cart', 60 );
add_action( 'storefront_header', 'storefront_header_cart', 60 );
/**
* Cart fragment
@ -105,7 +105,7 @@ if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) {
* @see storefront_woocommerce_brands_homepage_section()
*/
if ( class_exists( 'WC_Brands' ) ) {
add_action( 'woocommerce_archive_description', 'storefront_woocommerce_brands_archive', 5 );
add_action( 'woocommerce_single_product_summary', 'storefront_woocommerce_brands_single', 4 );
add_action( 'homepage', 'storefront_woocommerce_brands_homepage_section', 80 );
add_action( 'woocommerce_archive_description', 'storefront_woocommerce_brands_archive', 5 );
add_action( 'woocommerce_single_product_summary', 'storefront_woocommerce_brands_single', 4 );
add_action( 'homepage', 'storefront_woocommerce_brands_homepage_section', 80 );
}

View file

@ -16,7 +16,8 @@ get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) :
<?php
if ( have_posts() ) :
get_template_part( 'loop' );
@ -24,7 +25,8 @@ get_header(); ?>
get_template_part( 'content', 'none' );
endif; ?>
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->

View file

@ -10,7 +10,8 @@
do_action( 'storefront_loop_before' );
while ( have_posts() ) : the_post();
while ( have_posts() ) :
the_post();
/**
* Include the Post-Format-specific template for the content.

View file

@ -15,7 +15,9 @@ get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post();
<?php
while ( have_posts() ) :
the_post();
do_action( 'storefront_page_before' );
@ -28,7 +30,8 @@ get_header(); ?>
*/
do_action( 'storefront_page_after' );
endwhile; // End of the loop. ?>
endwhile; // End of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->

View file

@ -13,16 +13,23 @@ get_header(); ?>
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title"><?php printf( esc_attr__( 'Search Results for: %s', 'storefront' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
<h1 class="page-title">
<?php
/* translators: %s: search term */
printf( esc_attr__( 'Search Results for: %s', 'storefront' ), '<span>' . get_search_query() . '</span>' );
?>
</h1>
</header><!-- .page-header -->
<?php get_template_part( 'loop' );
<?php
get_template_part( 'loop' );
else :
get_template_part( 'content', 'none' );
endif; ?>
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->

View file

@ -10,7 +10,9 @@ get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post();
<?php
while ( have_posts() ) :
the_post();
do_action( 'storefront_single_post_before' );
@ -18,7 +20,8 @@ get_header(); ?>
do_action( 'storefront_single_post_after' );
endwhile; // End of the loop. ?>
endwhile; // End of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->

View file

@ -12,7 +12,9 @@ get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post();
<?php
while ( have_posts() ) :
the_post();
do_action( 'storefront_page_before' );
@ -25,7 +27,8 @@ get_header(); ?>
*/
do_action( 'storefront_page_after' );
endwhile; // End of the loop. ?>
endwhile; // End of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->

View file

@ -29,7 +29,8 @@ get_header(); ?>
* @hooked storefront_on_sale_products - 60
* @hooked storefront_best_selling_products - 70
*/
do_action( 'homepage' ); ?>
do_action( 'homepage' );
?>
</main><!-- #main -->
</div><!-- #primary -->