Celogeek Wiki

It seems that you use Adblock or an adblocker on my site. Ads help me to provide this site and keep it on a high speed and quality level. Please add my site on your white list. Thanks.

Table of Contents

The Plugin

Welcome to CGML plugin homepage.

Here the plugin URL : http://wordpress.org/extend/plugins/cgml/

Changelog

  • v0.6.2 : fix dependancy on short tag, add belorussian translation (thanks to Marcis G.)
  • v0.6.1 : fix cgml languages links
  • 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.

Click to enlarge :

CGML 01

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 :

In my french blog :

Click to enlarge :

CGML 01

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.

Click to enlarge :

CGML 01

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” and “single.php”.

Well, actually 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(), ' &#8212; <span class="cgml_languages">'.__('Other Languages','cgml').':&nbsp;','</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.

Click to enlarge :

CGML 01

If you love “widgets”, so you can activate the CGML one :

Click to enlarge :

CGML 01

You will have access to many options in order to customize the CGML languages selector.

It's done !

Celogeek


Navigation