Backwards compat for #3118

This commit is contained in:
Coen Jacobs 2013-05-17 08:55:55 +02:00
parent 64044fa888
commit 9478379041
2 changed files with 26 additions and 9 deletions

View File

@ -1028,13 +1028,16 @@ class WC_Shortcodes {
function related_products_shortcode( $atts ) {
$atts = shortcode_atts( array(
'per_page' => '2',
'posts_per_page' => '2',
'columns' => '2',
'orderby' => 'rand',
), $atts);
if ( isset( $atts['per_page'] ) ) {
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.1', __( 'Use $args["posts_per_page"] instead. Deprecated argument will be removed in WC 2.1.', 'woocommerce' ) );
$atts['posts_per_page'] = $atts['per_page'];
unset( $atts['per_page'] );
}
ob_start();

View File

@ -840,9 +840,23 @@ if ( ! function_exists( 'woocommerce_related_products' ) ) {
* Output the related products.
*
* @access public
* @param array Provided arguments
* @param bool Columns argument for backwards compat
* @param bool Order by argument for backwards compat
* @return void
*/
function woocommerce_related_products( $args = array() ) {
function woocommerce_related_products( $args = array(), $columns = false, $orderby = false ) {
if ( ! is_array( $args ) ) {
_deprecated_argument( __CLASS__ . '->' . __FUNCTION__, '2.1', __( 'Use $args argument as an array instead. Deprecated argument will be removed in WC 2.1.', 'woocommerce' ) );
$argsvalue = $args;
$args = array(
'posts_per_page' => $argsvalue,
'columns' => $columns,
'orderby' => $orderby,
);
}
$defaults = array(
'posts_per_page' => 2,