The Plugin
Welcome to CGML plugin homepage.
Here the plugin URL : http://wordpress.org/extend/plugins/cgml/
Changelog
v0.6 : add widget language selector
v0.5 : add version in admin page
v0.4 : add activation in cgml page
v0.3 : Add suffix and prefix in cgml_languages for maximum flexibility.
v0.2 : Fix footer.
v0.1 : Initial version. Allow you to link many blogs together and display flags in posts where you had indicate a translation.
How it work
Take zip file on wordpress website (url on top).
Unpack it under “wp-content/plugins”.
Go to plugin screen.
Activate the plugin.
A new menu appear in “Settings” : CGML.
You can click on “Settings” directly on plugins screen to configure it.
You have to activate the plugin CGML in his setting page after setting done.
Now you can add language. Each one will be identify by a key and an URL. You can also have many languages on the same blog but it’s better to have different instance of wordpress. With different instance, each one can have menu and tags in right language.
Fill the form to add a language.
Flag : This icon will appear on each post and page.
Custom Key : Key use to indicate that a translation is available.
Language label : Title when you pass your mouse over the link.
URL : Link to the blog.
Example for my blog :
Drapeau : French
Custom Key : fr
Label : Français
URL : http://blog.celogeek.fr/
In my french blog :
Flag : English
Custom Key : en
Label : Anglais
URL : http://blog.celogeek.com/
Now to use this on your page or your post, just add a custom key “cgml” and use this value :
custom key:post id
Example :
fr:1071
This will add a french flag (the one with “fr” custom key), with “Français” title and an url like this “http://blog.celogeek.fr?p=1071″.
If you want to add more language, just add other “cgml” custom key
Example :
it:1010
With this example you will add 2 “cgml” custom key, one with “fr:1071″ value and other with “it:1010″ value.
Well, this is perfect but you need one more thing. You have to slightly modify your theme to add the flag system on your page and post.
Generally you have 3 files to change, “index.php”, “page.php” et “single.php”, in fact, all page with an “Edit this”.
Track the place where we show post. Find something like “while (have_posts()): the_posts()”. Find the post headers.
It should be something like “edit_post_link(‘Edit This’)”, just before “</div>” push this :
<?php if (function_exists(‘cgml_languages’)) cgml_languages(get_the_ID(), ‘ — <span class="cgml_languages">’.__(‘Other Languages’,'cgml’).’: ’,'</span>’) ?>
It will call the function that handle flags. It take 2 parameters. First one is the post id. Second one is the prefix. Third one is the suffix. In my case, a dash follow by a span and the “Other Language” already translate in cgml plugin.
If you love “widgets”, so you can activate the CGML one :
![]()
You will have access to many options in order to customize the CGML languages selector.
It’s done !
Celogeek


August 22nd, 2009 18:25
[...] This post was Twitted by celogeek [...]
August 23rd, 2009 5:30
[...] CGML (Celogeek Multi Languages). Позволяет связывать много блогов на разных языках. [...]