Hi!
I've been trying to build a bilingual website (English and Chinese) and it works perfect with an exception: the rewrites for CPTs and custom taxonomies.
The structure I have right now is:
http://www.domain.com/en/products/cat1/prod1
http://www.domain.com/zh/products/cat1-zh/prod1-zh where "products" is a page with a custom template to hold all the "product_categories"
and I'd like to have:
http://www.domain.com/en/products/cat1/prod1
http://www.domain.com/zh/products-zh/cat1-zh/prod1-zh or even better http://www.domain.com/中文/products-zh/cat1-zh/prod1-zh (translating the language code too)
This is what I tried but it doesn't work. The "products" gets translated after the rewrite is outputed.
pll_register_string('Products Slug','products');
function register_taxonomy_product_categories() {
......
$args = array(
'hierarchical' => true,
'rewrite' => array('slug'=>pll__('products'),
);
register_taxonomy( 'product_categories', array('products'), $args );
}
add_action( 'init', 'register_cpt_products' );
function register_cpt_products() {
.....
$args = array(
'hierarchical' => false,
'taxonomies' => array( 'product_categories' ),
'has_archive' => false,
'rewrite' => array('permastruct'=>pll__('products').'/%product_categories%/%postname%'),
'capability_type' => 'post'
);
register_post_type( 'products', $args );
}
Any leads and suggestions will be greatly appreciated!