Created
August 16, 2012 15:33
-
-
Save wpsmith/3371109 to your computer and use it in GitHub Desktop.
Mutliple Taxonomy Endpoints
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
| <?php | |
| add_action( 'init', 'wps_lords_add_endpoints', 15 ); | |
| /** | |
| * Lord's Endpoint addition for Manufacturer and Category Combination | |
| * | |
| * @uses add_permastruct() | |
| * @uses add_rewrite_rule() | |
| */ | |
| function wps_lords_add_endpoints() { | |
| $shopp_manufacturer = get_taxonomy( 'shopp_manufacturer' ); | |
| $shopp_category = get_taxonomy( 'shopp_category' ); | |
| add_permastruct( | |
| $shopp_manufacturer->name . '-' . $shopp_category->name, | |
| "{$shopp_manufacturer->rewrite['slug']}/%$shopp_manufacturer->name%/{$shopp_category->rewrite['slug']}/%$shopp_category->name%", | |
| array( | |
| 'with_front' => false, | |
| 'ep_mask' => EP_NONE, | |
| ) | |
| ); | |
| add_rewrite_rule( 'inventory/manufacturer/([^/]+)/category/([^/]+)/?$', 'index.php?shopp_manufacturer=$matches[1]&shopp_category=$matches[2]', 'top' ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment