Skip to content

Instantly share code, notes, and snippets.

@Shininglow
Created November 30, 2017 10:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shininglow/74dc557c363d7b81f7b6a4338f752329 to your computer and use it in GitHub Desktop.
Save Shininglow/74dc557c363d7b81f7b6a4338f752329 to your computer and use it in GitHub Desktop.
/**
* WooCommerce Extra Feature
* --------------------------
*
* Change number of related products on product page
* Set your own value for 'posts_per_page'
*
*/
function woo_related_products_limit() {
global $product;
$args['posts_per_page'] = 6;
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );
function jk_related_products_args( $args ) {
$args['posts_per_page'] = 4; // 4 related products
$args['columns'] = 2; // arranged in 2 columns
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment