I'm using WPML plugin to translate my site. I have a custom post type called "vinos" and I use this args:
$args = array(
'labels' => $labels,
'hierarchical' => false,
'supports' => array('title', 'thumbnail'),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 6,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => 'nuestros-vinos/catalogo',
'query_var' => true,
'can_export' => true,
'capability_type' => 'post',
'rewrite' => array('slug' => 'nuestros-vinos/catalogo/marcas/%marcas%')
);
register_post_type('vinos', $args);
The problem is that I can't translate my string "nuestros-vinos/catalogo/marcas" to english and for that reason my urls are:
www.domain.com/nuestros-vinos/catalogo/ ---------> show all my list of wines in spanish www.domain.com/en/nuestros-vinos/catalogo/ ------> show all my list of wines in english
but I would like that in english version, the url was:
www.domain.com/en/our-wines/catalog/
I'm trying to use rewrite rules:
add_filter('generate_rewrite_rules', 'customposttype_rewrites');
function customposttype_rewrites($wp_rewrite) {
$newrules = array();
$newrules['en/our-wines/catalog/?$'] = 'en/index.php?post_type=vinos';
$wp_rewrite->rules = $newrules + $wp_rewrite->rules;
}
But it doesn't work, always page not found.
How can I do it?
Thanks.
'has_archive' => true
instead of naming the archive explictly?