Merge pull request #893 from woocommerce/fix/892

Update homepage shortcodes
This commit is contained in:
Tiago Noronha 2018-05-30 14:06:13 +01:00 committed by GitHub
commit 64d7ece8f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -610,12 +610,16 @@ if ( ! function_exists( 'storefront_recent_products' ) ) {
if ( storefront_is_woocommerce_activated() ) { if ( storefront_is_woocommerce_activated() ) {
$args = apply_filters( 'storefront_recent_products_args', array( $args = apply_filters( 'storefront_recent_products_args', array(
'limit' => 4, 'limit' => 4,
'columns' => 4, 'columns' => 4,
'title' => __( 'New In', 'storefront' ), 'orderby' => 'date',
'order' => 'desc',
'title' => __( 'New In', 'storefront' ),
) ); ) );
$shortcode_content = storefront_do_shortcode( 'recent_products', apply_filters( 'storefront_recent_products_shortcode_args', array( $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'] ), 'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ), 'columns' => intval( $args['columns'] ),
) ) ); ) ) );
@ -658,18 +662,20 @@ if ( ! function_exists( 'storefront_featured_products' ) ) {
if ( storefront_is_woocommerce_activated() ) { if ( storefront_is_woocommerce_activated() ) {
$args = apply_filters( 'storefront_featured_products_args', array( $args = apply_filters( 'storefront_featured_products_args', array(
'limit' => 4, 'limit' => 4,
'columns' => 4, 'columns' => 4,
'orderby' => 'date', 'orderby' => 'date',
'order' => 'desc', 'order' => 'desc',
'title' => __( 'We Recommend', 'storefront' ), 'visibility' => 'featured',
'title' => __( 'We Recommend', 'storefront' ),
) ); ) );
$shortcode_content = storefront_do_shortcode( 'featured_products', apply_filters( 'storefront_featured_products_shortcode_args', array( $shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_featured_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ), 'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ), 'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ), 'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ), 'order' => esc_attr( $args['order'] ),
'visibility' => esc_attr( $args['visibility'] ),
) ) ); ) ) );
/** /**
@ -712,12 +718,16 @@ if ( ! function_exists( 'storefront_popular_products' ) ) {
$args = apply_filters( 'storefront_popular_products_args', array( $args = apply_filters( 'storefront_popular_products_args', array(
'limit' => 4, 'limit' => 4,
'columns' => 4, 'columns' => 4,
'orderby' => 'rating',
'order' => 'desc',
'title' => __( 'Fan Favorites', 'storefront' ), 'title' => __( 'Fan Favorites', 'storefront' ),
) ); ) );
$shortcode_content = storefront_do_shortcode( 'top_rated_products', apply_filters( 'storefront_popular_products_shortcode_args', array( $shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_popular_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ), 'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ), 'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
) ) ); ) ) );
/** /**
@ -760,12 +770,18 @@ if ( ! function_exists( 'storefront_on_sale_products' ) ) {
$args = apply_filters( 'storefront_on_sale_products_args', array( $args = apply_filters( 'storefront_on_sale_products_args', array(
'limit' => 4, 'limit' => 4,
'columns' => 4, 'columns' => 4,
'orderby' => 'date',
'order' => 'desc',
'on_sale' => 'true',
'title' => __( 'On Sale', 'storefront' ), 'title' => __( 'On Sale', 'storefront' ),
) ); ) );
$shortcode_content = storefront_do_shortcode( 'sale_products', apply_filters( 'storefront_on_sale_products_shortcode_args', array( $shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_on_sale_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ), 'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ), 'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
'on_sale' => esc_attr( $args['on_sale'] ),
) ) ); ) ) );
/** /**
@ -807,12 +823,16 @@ if ( ! function_exists( 'storefront_best_selling_products' ) ) {
$args = apply_filters( 'storefront_best_selling_products_args', array( $args = apply_filters( 'storefront_best_selling_products_args', array(
'limit' => 4, 'limit' => 4,
'columns' => 4, 'columns' => 4,
'orderby' => 'popularity',
'order' => 'desc',
'title' => esc_attr__( 'Best Sellers', 'storefront' ), 'title' => esc_attr__( 'Best Sellers', 'storefront' ),
) ); ) );
$shortcode_content = storefront_do_shortcode( 'best_selling_products', apply_filters( 'storefront_best_selling_products_shortcode_args', array( $shortcode_content = storefront_do_shortcode( 'products', apply_filters( 'storefront_best_selling_products_shortcode_args', array(
'per_page' => intval( $args['limit'] ), 'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ), 'columns' => intval( $args['columns'] ),
'orderby' => esc_attr( $args['orderby'] ),
'order' => esc_attr( $args['order'] ),
) ) ); ) ) );
/** /**