diff --git a/readme.txt b/readme.txt
index 63410363b85..bf377650095 100644
--- a/readme.txt
+++ b/readme.txt
@@ -160,6 +160,9 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Feature - Export and Import Tax Rates from a CSV file.
* Feature - Option to control whether tax is calculated based on customer shipping or billing address.
* Feature - New options for individual transaction emails with template editor
+* Feature - Added "On Sale" shortcode (thanks daltonrooney)
+* Feature - Added "Best Selling" shortcode
+* Feature = Added "Top Rated" shortcode
* Templating - email-order-items.php change get_downloadable_file_url() to get_downloadable_file_urls() to support multiple files.
diff --git a/shortcodes/shortcode-init.php b/shortcodes/shortcode-init.php
index 5babc95dff4..4d48e39eff9 100644
--- a/shortcodes/shortcode-init.php
+++ b/shortcodes/shortcode-init.php
@@ -507,29 +507,147 @@ function woocommerce_sale_products( $atts ){
)
);
- ob_start();
+ ob_start();
- $products = new WP_Query( $args );
+ $products = new WP_Query( $args );
+
+ $woocommerce_loop['columns'] = $columns;
- $woocommerce_loop['columns'] = $columns;
+ if ( $products->have_posts() ) : ?>
- if ( $products->have_posts() ) : ?>
+
-
+ have_posts() ) : $products->the_post(); ?>
- have_posts() ) : $products->the_post(); ?>
+
-
+
-
+
-
+ '12',
+ 'columns' => '4'
+ ), $atts ) );
+
+ $args = array(
+ 'post_type' => 'product',
+ 'post_status' => 'publish',
+ 'ignore_sticky_posts' => 1,
+ 'posts_per_page' => $per_page,
+ 'meta_key' => 'total_sales',
+ 'orderby' => 'meta_value',
+ 'meta_query' => array(
+ array(
+ 'key' => '_visibility',
+ 'value' => array( 'catalog', 'visible' ),
+ 'compare' => 'IN'
+ )
+ )
+ );
+
+ ob_start();
+
+ $products = new WP_Query( $args );
+
+ $woocommerce_loop['columns'] = $columns;
+
+ if ( $products->have_posts() ) : ?>
+
+
+
+ have_posts() ) : $products->the_post(); ?>
+
+
+
+
+
+
+
+ '12',
+ 'columns' => '4',
+ 'orderby' => 'title',
+ 'order' => 'asc'
+ ), $atts ) );
+
+ $args = array(
+ 'post_type' => 'product',
+ 'post_status' => 'publish',
+ 'ignore_sticky_posts' => 1,
+ 'orderby' => $orderby,
+ 'order' => $order,
+ 'posts_per_page' => $per_page,
+ 'meta_query' => array(
+ array(
+ 'key' => '_visibility',
+ 'value' => array('catalog', 'visible'),
+ 'compare' => 'IN'
+ )
+ )
+ );
+
+ ob_start();
+
+ add_filter( 'posts_clauses', 'woocommerce_order_by_rating_post_clauses' );
+
+ $products = new WP_Query( $args );
+
+ remove_filter( 'posts_clauses', 'woocommerce_order_by_rating_post_clauses' );
+
+ $woocommerce_loop['columns'] = $columns;
+
+ if ( $products->have_posts() ) : ?>
+
+
+
+ have_posts() ) : $products->the_post(); ?>
+
+
+
+
+
+
+
+ commentmeta.meta_key = 'rating' ";
+
+ $args['join'] .= "
+ LEFT JOIN $wpdb->comments ON($wpdb->posts.ID = $wpdb->comments.comment_post_ID)
+ LEFT JOIN $wpdb->commentmeta ON($wpdb->comments.comment_ID = $wpdb->commentmeta.comment_id)
+ ";
+
+ $args['orderby'] = "$wpdb->commentmeta.meta_value DESC";
+
+ $args['groupby'] = "$wpdb->posts.ID";
+
+ return $args;
+}
+
/**
* Shortcode creation
**/
@@ -675,6 +818,8 @@ add_shortcode('add_to_cart_url', 'woocommerce_product_add_to_cart_url');
add_shortcode('products', 'woocommerce_products');
add_shortcode('recent_products', 'woocommerce_recent_products');
add_shortcode('sale_products', 'woocommerce_sale_products');
+add_shortcode('best_selling_products', 'woocommerce_best_selling_products');
+add_shortcode('top_rated_products', 'woocommerce_top_rated_products');
add_shortcode('featured_products', 'woocommerce_featured_products');
add_shortcode('woocommerce_cart', 'get_woocommerce_cart');
add_shortcode('woocommerce_checkout', 'get_woocommerce_checkout');