Last active
August 29, 2015 14:01
-
-
Save danjjohnson/17c28916716943bdfcd1 to your computer and use it in GitHub Desktop.
Change the number of recent products displayed on Superstore homepage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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