danjjohnson
5/7/2014 - 8:12 AM

Change the number of recent products displayed on Superstore homepage

Change the number of recent products displayed on Superstore homepage

<?php

add_action( 'admin_head', 'woo_custom_options', 50 );
function woo_custom_options(){
	$limit = array();
	//set the limit to 40
	for ( $i = 1; $i <= 40; $i++ ) {
	    $limit[$i] = $i;
	}
	
	global $options;
	$options = get_option( 'woo_template' );
	
	//Find the recent_products_limit option and change it to the $limit value set above
	foreach( $options as $key => $option ) {
		if( $option['id'] == 'woo_homepage_recent_products_limit' ) {
			$options[$key]['options'] = $limit;
		}
	}
	//update the options
	if ( get_option( 'woo_template') != $options) update_option( 'woo_template',$options);
}

?>