( i open a new question since i found why my slug don't translate in generated links, sorry if it is an error, but sounds logical for me ).
so i use WPML and Custom Posts Type on my wordpress.
i also add .html to my CPT with a code found here on stackexchange.
// .html pour les customs posts
function rewrite_rules($rules) {
$new_rules = array();
foreach (get_post_types() as $t)
$new_rules[$t . '/(.+?)\.html$'] = 'index.php?post_type=' . $t . '&name=$matches[1]';
return $new_rules + $rules;
}
add_action('rewrite_rules_array', 'rewrite_rules');
function custom_post_permalink ($post_link) {
global $post;
if ( $post ) {
$type = get_post_type($post->ID);
return home_url() . '/' . $type . '/' . $post->post_name . '.html';
}
}
add_filter('post_type_link', 'custom_post_permalink'); // for cpt post_type_link (rather than post_link)
BUT
with this function, then my generated URLS dont use translated slug, but default language slug and goes to 404.
How can i edit this code to get the correct WPML slug for CPT ?
if i take of this code, it works perfect, but without .html at the end of my URLS.
Thanks a lot for your precious help