Last active
August 29, 2015 14:20
-
-
Save nickkuijpers/f05653ef049f0bd1a5ea to your computer and use it in GitHub Desktop.
WooCommerce Add Amount Per Page
This file contains hidden or 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
$value = $_POST['woocommerce-sort-by-columns']; | |
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return ' . $value . ';' ), 20 ); | |
function woocommerce_catalog_page_ordering($value) { | |
$amounts = array( | |
20, | |
30, | |
80, | |
160, | |
250 | |
); | |
echo '<form action="" method="post" name="results">'; | |
echo '<select class="woocommerce-sort-by-columns" name="woocommerce-sort-by-columns" onchange="document.forms[\'results\'].submit();">'; | |
foreach($amounts as $amount){ | |
if($amount == $value){ | |
$selected = "SELECTED"; | |
} else { | |
$selected = ""; | |
} | |
echo '<option value="' . $amount . '" ' . $selected . '>' . $amount . ' producten</option>'; | |
} | |
echo '</select>'; | |
echo '</form>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment