Created
May 8, 2012 15:30
-
-
Save dancameron/2636341 to your computer and use it in GitHub Desktop.
GBS :: Add custom rewrite rules for filtering vouchers
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 custom rewrite rules for filtering vouchers | |
* | |
* @param array $vars | |
* @return array | |
*/ | |
public function custom_mngt_voucher_rewrite_rules( $rules ) { | |
global $wp_rewrite; | |
$rules['cupones/caducados(/page/?([0-9]{1,}))?/?$'] = 'index.php?post_type='.Group_Buying_Voucher::POST_TYPE.'&paged='.$wp_rewrite->preg_index( 2 ).'&'.Group_Buying_Vouchers::FILTER_QUERY_VAR.'='.Group_Buying_Vouchers::FILTER_EXPIRED_QUERY_VAR; | |
$rules['cupones/usados(/page/?([0-9]{1,}))?/?$'] = 'index.php?post_type='.Group_Buying_Voucher::POST_TYPE.'&paged='.$wp_rewrite->preg_index( 2 ).'&'.Group_Buying_Vouchers::FILTER_QUERY_VAR.'='.Group_Buying_Vouchers::FILTER_USED_QUERY_VAR; | |
$rules['cupones/activos(/page/?([0-9]{1,}))?/?$'] = 'index.php?post_type='.Group_Buying_Voucher::POST_TYPE.'&paged='.$wp_rewrite->preg_index( 2 ).'&'.Group_Buying_Vouchers::FILTER_QUERY_VAR.'='.Group_Buying_Vouchers::FILTER_ACTIVE_QUERY_VAR; | |
return $rules; | |
} | |
add_filter( 'gb_rewrite_rules', 'custom_mngt_voucher_rewrite_rules', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment