Reputation: 483
I'm using Wordpress 5 et WPML. I have a lot of custom type. Each custom type has his slug.
My website is in english and french
Exemple :
I need to translate city and country in french :
How can i translate the slug ?
Example of cuctom type :
$rewrite = array(
'slug' => 'city',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'Les villes', 'test' ),
'description' => __( 'Les villes', 'test' ),
'labels' => $labels,
'supports' => array( 'title', 'thumbnail' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-home',
'show_in_admin_bar' => false,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'page',
'show_in_rest' => true,
);
register_post_type( 'villes', $args );
}
add_action( 'init', 'villes_post_type', 0 );
Upvotes: 0
Views: 2015
Reputation: 536
Since you are using WPML, you can achieve this with an addon for WPML.
Upvotes: 2