“the j stands for Jotting”
about me | research blog | wordpress plugins | jQuery plugins

25 August, 2009

qTranslate and Theme Hybrid: Multilingual META fields

So I wrote this code for allowing multilingual editing of the META fields when using Theme Hybrid (the “Hybrid Settings” panel on any add/edit post/page.

Here is the functions.php file, this should of course be combined with whatever else you’re using..

This is still an early version, so if anyone tries it out let me know if you have any issues/feature suggestions!

Download: functions-example.zip

17 Comments »

  1. hey John, the link is broken? the file is 0 bytes?

    Comment by ovidiu — 26 August, 2009 @ 8:57 am

  2. Ah, it was trying to actually exec the php file on the server, hadn’t thought about that! Zipped it now, should work fine.

    Comment by John — 26 August, 2009 @ 9:29 am

  3. ok, will give it another try. one more question: I am not sure how these metatags in multiple languages and the multiple language content affects search engines 🙁 – I udnerstand that if a human visits and selects a language he will only see that language content everywhere, but what happens if a search engine visits? what language is presented then?

    Comment by ovidiu — 26 August, 2009 @ 10:05 am

  4. Well, remember that each language version of a page is accessible by a different URL.
    So http://mysite.com/en/page/ for English and http://mysite.com/it/page/ for Italian for example.
    A search engine would land on your default language page, but it should be able to reach all multilingual versions of the page since there are hyperlinks to them in the language switcher widget, and of course it will notice they’re in different languages. Also only the English META details will display on the English version (and same for all langauges) so it should index them correctly… there’s no reason why the multi-lingual content should negatively affect your SEO…

    Comment by John — 26 August, 2009 @ 10:15 am

  5. ahh! how silly of me 🙂 thanks for reminding me of that, I just started to sweat, fearing I had done something I didn’t want… Its been a long time since I compared a couple of multi language plugins and decided to use qtranslate as it seemed best for my purposes…

    btw. please contact me directly (you have my email) in case you make any other break through with hybrid and qtranslate I’d be happy to test.

    is there anything else that is not being translated by default? i.e. the slug of articles, but I think there is nothing to be done about that, right?

    Comment by ovidiu — 26 August, 2009 @ 10:24 am

  6. Well I had a small issue with widget titles, although it’s not really a Hybrid issue… basically I got around it using quicktags since you only need to “do it once”.. however the META stuff and post excerpt are more important, and using language tags for many languages quickly gets messy. Incidentally, I hope to make the excerpt box multilingual soon, I just need some time to think about how best to do it.
    Yes the multilingual slugs is really the big must-have feature, and many people have requested it (http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=4&t=78) but it’s non-trivial to implement. I hope that the qTranslate author will add that feature some time in the future.
    I hope to set up a small page specifically for posting all my qTranslate tweaks, when I get some time will put it together.

    Comment by John — 26 August, 2009 @ 10:32 am

  7. any experience with this plugin: http://www.dagondesign.com/articles/sitemap-generator-plugin-for-wordpress/

    its display is currently pretty broken: http://www.quilombobrasil.com/sitemap/ any idea?

    Comment by ovidiu — 3 September, 2009 @ 10:43 am

  8. No never used this plugin, I use this one instead: http://wordpress.org/extend/plugins/google-sitemap-generator/
    Although I hadn’t considered the sitemaps problem.. will get back once I investigate more…

    Comment by John — 4 September, 2009 @ 9:49 am

  9. ok, thx but please have a look at the one I gave. its not for SEO but for humans 🙂

    p.s. I read there are/were some problems with qtranslate and the sitemap generator you linked too… if you figure something out, let me know I am using that one too.

    Comment by ovidiu — 4 September, 2009 @ 11:58 am

  10. Hey John,

    sorry for cluttering this page but I have another question qtranslate related:

    how do you deal with meta keywords and description on the frontpage?

    I am using a customized home.php which has a dynamic call to header.php fro mthe original hybrid theme so to change anything I replaced that call to ehader.php with the cotnent of header.php and then inserted meta keywords and descripotions into home.php but how would I insert several languages there?

    can you give me some hitns how you do it?

    Comment by ovidiu — 10 September, 2009 @ 8:30 am

  11. 🙁 and another helpless request: I asked on the hybrid forums how to manually change meta keywords and description on the homepage and I got an answer, but now I struggle to combine this solution with qtranslate again 🙁

    `add_filter( ‘hybrid_meta_keywords’, ‘my_meta_keywords’ );
    add_filter( ‘hybrid_meta_description’, ‘my_meta_description’ );

    function my_meta_keywords( $keywords ) {
    if ( is_home() )
    $keywords = ‘something, goes, here’;
    return $keywords;
    }

    function my_meta_description( $description ) {
    if ( is_home() )
    $description = ‘this is my description’;
    return $description;
    }`

    how would that look for lets say 2 language?

    Comment by ovidiu — 11 September, 2009 @ 8:59 am

  12. 🙁 and another helpless request: I asked on the hybrid forums how to manually change meta keywords and description on the homepage and I got an answer, but now I struggle to combine this solution with qtranslate again 🙁

    `add_filter( 'hybrid_meta_keywords', 'my_meta_keywords' );
    add_filter( 'hybrid_meta_description', 'my_meta_description' );

    function my_meta_keywords( $keywords ) {
    if ( is_home() )
    $keywords = 'something, goes, here';
    return $keywords;
    }

    function my_meta_description( $description ) {
    if ( is_home() )
    $description = 'this is my description';
    return $description;
    }`

    how would that look for lets say 2 language?…

    Comment by Andriopulos — 11 September, 2009 @ 3:39 pm

  13. So,
    1. For sitemaps, I’ve decided to use this: http://www.neoegm.com/tech/wordpress/plugins/qtranslate-support-for-the-google-xml-sitemaps-generator-wordpress-plugin/
    Sorry but don’t have time atm to look into other plugins :/
    2. I’m not sure what you mean by “manually change meta keywords and description on the homepage” – every page has it’s own META info, which you can see in a box below the regular page editor…

    Comment by John — 15 September, 2009 @ 11:42 am

  14. 🙂 thx for the link to that modified plugin. I’ll just stop using the other sitemap plugin, although its just a graphic representation of the site structure, its for visitors not spiders.

    regarding the homepage: I use a home.php template so actually there is no real “page” where I can input keywords and description.

    that is why Justin gave me the above code and it works but I am unsure how to modify above code to include keywords and descripotions in 2 languages.

    Comment by ovidiu — 16 September, 2009 @ 10:56 am

  15. having problems since the upgrade to hybrid 0.7, getting:

    hybrid_post_meta_boxes — This function has been removed or replaced by another function.

    Would you mind helping update this code?

    Comment by Ovidiu — 6 January, 2010 @ 9:26 pm

  16. I haven’t switched to Hybrid 0.7, but to be honest I need to modify the whole META tags thing for my own purposes. I’m considering writing a standalone plugin to do it rather than using the Hybrid filters, will keep you posted when I have something.

    Comment by John — 7 January, 2010 @ 11:29 am

  17. great, thanks I appreciate it.

    Comment by Ovidiu — 7 January, 2010 @ 1:41 pm

Leave a comment