You can use localized slugs if you want but you must – in this case – use the ‘msls_options_get_permalink’-filter to let the switcher know what’s going on.
For example:
function my_msls_options_get_permalink( $url, $language ) {
if ( 'de_DE' == $language ) {
$url = str_replace( '/products/', '/produkte/', $url );
}
return $url;
}
add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );
Source: http://msls.co/hooks-filters-and-actions/
Cheers,
Dennis.
Thread Starter
dl80
(@dl80)
Thank you for your quick reply.
But this filter is only for different slugs, isn’t it?
So far, I am registering a “products” (same name) post_type in both blogs but with different settings (labels, slugs) and it seems to be working.
It is not possible to have a post_type “produkte” in the /de/ blog and a post_type “products” in the /en/ blog and link them, right?
Sorry, I’m not sure if i’m really understanding it 😉
No … you can localize almost everything – labels and even slugs – but you cannot tie together different post types.
Thread Starter
dl80
(@dl80)
Thank you again!
Do you know any guide of how such localization should be done?
So far, i wrote a Plugin, which uses a simple switch:
$currentlang = get_bloginfo('language');
if($currentlang == "de-DE") {
require_once('de_posttypes.php');
require_once('de_taxonomies.php');
}
elseif ($currentlang == "en-US") {
require_once('en_posttypes.php');
require_once('en_taxonomies.php');
}
else {
add_action( 'admin_init', 'deactivate_plugin_conditional' );
}
in these four plugin files, i do the different register calls with the same post_type name and the same taxonomy name but different labels and slugs depending on the language.
is there any better way to achieve this?
thank you for your convenient help!