Skip to content

Instantly share code, notes, and snippets.

@danjjohnson
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danjjohnson/17c28916716943bdfcd1 to your computer and use it in GitHub Desktop.
Save danjjohnson/17c28916716943bdfcd1 to your computer and use it in GitHub Desktop.
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);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment