as for first question – i am already have such request from Lukas Konaric (checz wp_multilingual localizer)
as for second one, – i see a reason in your words.
i am not tell for sure – that requests will be at next version, but i will try to do it asap.
Thanks for your answer and for your reactivity. I’ll try to be patient once (regarding of my previous post concerning the WYSIWYG editor). But those two points are important for me.
Read you soon,
David
Hi again,
If I use the wordpress function get_permalink() for a post or a page, I have not the language in the generated URL. How to make it appear correctly in the URL ?
For example: I have a page “Login” with the ID = 14. When I use get_permalink(14), I get “http://www.example.com/blog/login” assuming my blog is in the “/blog/” directory.
Thanks in advance for the tip or the new feature.
Greatings,
David
In fact, I’m generating some permalinks in the “functions.php” of my theme (derived from the classic one) and the $GLOBALS[‘language’] in not yet know. I finally use the following code: $loginPermalink = get_permalink(get_page_by_path('login')->ID);
Not a bug or a missing feature š
David
i will try to make butifull release 1.4 hope i can add this feature too.
Hi,
I just wrote a new function called “get_permalink_by_path” as follow:
function get_permalink_by_path( $path, $output = OBJECT ) {
if ( !$page = get_page_by_path($path) ) return NULL;
return get_permalink($page->ID);
} // end of 'get_permalink_by_path()'
It work fine for me. The thing you can add is that the $GLOBALS[‘language’] would be available before the “functions.php” file of a template is loaded.
One other thing I noticed: my default language is english for a blog. When I switch to french for example and I click on the header to go to the home, the language switch back to english instead of keeping french? how to keep a choosen language even for this situation?
Last point, I there a way to check the HTTP_ACCEPT_LANGUAGE to determine the language of the user (his browser in fact)? I would be a nice feature to had.
Thanks in advance,
David
Hi, David,
to keep the language when clicking on the header, if you’re using WordPress default Kubrick theme, in header.php, instead of
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
try using
<h1><a href="<?php echo get_option('home'); ?>/<?php echo $language; ?>"><?php bloginfo('name'); ?></a></h1>
Cheers,
Beto
Hi Beto,
Thanks for the tip, it’s fine now!
David
Hi,
I still need the ability to translate the permalink, when do you think it will be possible?
And I still need to filter comments by language, will it be possible?
Thanks in advance,
David
i dont know… but you can try!
Hi,
I’ve juste created an extension which allow to translate the slug of a post (not a page at this moment). It require WP_Multilingual.
You can download it at this address: http://projects.maleo.net/wp-multilingual-extended/
It adds a “Permalinks” box in the edit box of a post, with one input by WP_Multilingual declared language. During saving, it creates a post meta name “post_slug_{language}” (ex: “post_slug_fr”). It take the title of the post by default (or the titles of each language by default).
In the front site, it take the “post_name” of each post to replace it by the “post_slug_{language}” of the current language.
The only “oooops” for this plugin is that we need to modify the “get_post” function of the core of WP located in the file “/wp-includes/post.php”: we need to add the line: apply_filters('get_the_post', $_post); just after: $_post = sanitize_post($_post, $filter); I don’t find any existing hook for the purpose of this plugin.
For this version of the plugin, there is no check of a possible duplicated slug, no possilibity to translate pages slugs. It’s first a proof of concept and, I hope so, a piece of code you could implement in your plugin.
Cheers,
David