Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Created August 16, 2012 15:33
Show Gist options
  • Select an option

  • Save wpsmith/3371109 to your computer and use it in GitHub Desktop.

Select an option

Save wpsmith/3371109 to your computer and use it in GitHub Desktop.
Mutliple Taxonomy Endpoints
<?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