<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open Script Solution&#187; WPML</title>
	<atom:link href="http://www.openscriptsolution.com/tag/wpml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.openscriptsolution.com</link>
	<description>... where solutions for script programming are found ...</description>
	<lastBuildDate>Tue, 31 Jan 2012 03:22:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Remove a Trailing Slash from Home&#8217;s URL in Atahualpa 3.5.3 Theme of WordPress</title>
		<link>http://www.openscriptsolution.com/2010/08/10/how-to-remove-a-trailing-slash-from-homes-url-in-atahualpa-353-theme-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2010/08/10/how-to-remove-a-trailing-slash-from-homes-url-in-atahualpa-353-theme-of-wordpress/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 03:12:23 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Atahualpa]]></category>
		<category><![CDATA[beranda]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[trailing slash]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[WPML]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1259</guid>
		<description><![CDATA[Believe it or not, if you are running a multilingual site using Atahualpa theme and WPML plugin, you will find that there is a double trailing slash in the Home&#8217;s URL that generated by WPML, especially for Home&#8217;s URL belongs to the languages other than the default one and you are using the &#8220;directory per [...]]]></description>
			<content:encoded><![CDATA[<p>Believe it or not, if you are running a multilingual site using <a href="http://wordpress.bytesforall.com/" title="Atahualpa" target="_blank">Atahualpa</a> theme and <a href="http://wpml.org" title="WPML" target="_blank">WPML</a> plugin, you will find that there is a double trailing slash in the Home&#8217;s URL that generated by WPML, especially for Home&#8217;s URL belongs to the languages other than the default one and you are using the &#8220;directory per language&#8221; setting in WPML. This can be happened since Atahualpa add a trailing slash in every Home&#8217;s URL when the home page is being displayed, whereas WPML also added another trailing slash after the language code in the URL. So, this will make a double trailing slash in the Home&#8217;s URL. In order to remove one of these trailing slash, you can use this following modification. As time goes by, this modification being applied into Atahualpa version 3.5.3 (the last version while I was writing this article) and WordPress version 3.0.1. I am not sure whether this modification can be applied into the older versions. <span id="more-1259"></span></p>
<ol>
<li>
Open your <strong>/wp-content/themes/{youratahualpathemename}/bfa_header_config.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'/&quot;</span></pre></div></div>

<p>then replace with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot;</span></pre></div></div>

<p>Please note that part of code located in six different location at that file, so you have to replace it six times.
</li>
<li>
Open your <strong>/wp-content/themes/{youratahualpathemename}/bfa_footer.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'/&quot;</span></pre></div></div>

<p>then replace with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot;</span></pre></div></div>

</li>
<li>
Open your <strong>/wp-content/themes/{youratahualpathemename}/bfa_next_previous_links.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'/&quot;</span></pre></div></div>

<p>then replace with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot;</span></pre></div></div>

<p>Please note that part of code located in three different location at that file, so you have to replace it three times.
</li>
</ol>
<p>That&#8217;s all. Now you should have the proper Home&#8217;s URL according to their own languages.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2010%2F08%2F10%2Fhow-to-remove-a-trailing-slash-from-homes-url-in-atahualpa-353-theme-of-wordpress%2F&amp;title=How%20to%20Remove%20a%20Trailing%20Slash%20from%20Home%26%238217%3Bs%20URL%20in%20Atahualpa%203.5.3%20Theme%20of%20WordPress" id="wpa2a_2"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2010/08/10/how-to-remove-a-trailing-slash-from-homes-url-in-atahualpa-353-theme-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Overcome The Missing Posts/Pages After Upgrading to WPML plugin version 1.8.0 of WordPress</title>
		<link>http://www.openscriptsolution.com/2010/07/25/how-to-overcome-the-missing-postspages-after-upgrading-to-wpml-plugin-version-1-8-0-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2010/07/25/how-to-overcome-the-missing-postspages-after-upgrading-to-wpml-plugin-version-1-8-0-of-wordpress/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 05:34:37 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Pages]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[posts]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[WPML]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1244</guid>
		<description><![CDATA[For those of you who encountered the missing posts/pages after upgrading your WPML plugin to 1.8.0 version, then this following solutin might be help you. Since WPML changed the element_type value of post and page in the icl_translations table, ie each into post_post and post_page, then you have to adjust this value at the element_type [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who encountered the missing posts/pages after upgrading your <a href="http://wpml.org" title="WPML" target="_blank">WPML</a> plugin to 1.8.0 version, then this following solutin might be help you. Since WPML changed the <strong>element_type</strong> value of <strong>post</strong> and <strong>page</strong> in the <strong>icl_translations</strong> table, ie each into <strong>post_post</strong> and <strong>post_page</strong>, then you have to adjust this value at the element_type field. After doing comparison to several version of WMPL, I found out that this changes happened since WPML version above 1.7.7. In version 1.7.7, this field was still using <strong>post</strong> and <strong>page</strong> instead of <strong>post_post</strong> and <strong>post_page</strong>. Actually, when you upgrade your WPML to 1.8.0, this value will be automatically adjusted to the new value. But, in some cases, there are some websites that do not automatically turn to the new value, especially if they deactivate and activate the plugin manually (because they upgrade by replacing the files manually, and not using the auto-update feature). <span id="more-1244"></span></p>
<ol>
<li>
Go to your <strong>cPanel</strong> of your website, then choose <strong>phpMyAdmin</strong>.
</li>
<li>
Choose your WordPress database, and backup your database (as we will modify one of the tables of this database).
</li>
<li>
Click on the <strong>SQL</strong> tab, and then copy and paste this following SQL update:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">UPDATE wp_icl_translations t, wp_posts p
SET t.element_type = 'post_page'
WHERE p.ID = t.element_id
AND p.post_type = 'page';
&nbsp;
UPDATE wp_icl_translations t, wp_posts p
SET t.element_type = 'post_post'
WHERE p.ID = t.element_id
AND t.element_type = 'post';</pre></div></div>

<p>Assuming that the prefix of your table is <strong>wp_</strong>.<br />
Those 2 statement will update your <strong>wp_icl_translations</strong> table by replacing &#8220;post&#8221; become &#8220;post_post&#8221; for the posts you have already had, and then also replacing &#8220;post&#8221; become &#8220;post_page&#8221; for the pages you have already had.
</li>
<li>
Check again your site, and now the posts or your pages will appear properly.
</li>
<li>
If the problem still remains, then it usuallay caused by the older version of WordPress does not support to use WPML version 1.8.0. I have contacted WPML guru about this problem, and still waiting for the solution. Meanwhile, you can try those solutions above.
</li>
</ol>
<p>Hope it helps!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2010%2F07%2F25%2Fhow-to-overcome-the-missing-postspages-after-upgrading-to-wpml-plugin-version-1-8-0-of-wordpress%2F&amp;title=How%20to%20Overcome%20The%20Missing%20Posts%2FPages%20After%20Upgrading%20to%20WPML%20plugin%20version%201.8.0%20of%20WordPress" id="wpa2a_4"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2010/07/25/how-to-overcome-the-missing-postspages-after-upgrading-to-wpml-plugin-version-1-8-0-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Add Your Own Translation Link to Language Switcher by Using WPML Plugin of WordPress</title>
		<link>http://www.openscriptsolution.com/2010/07/14/how-to-add-your-own-translation-link-to-language-switcher-by-using-wpml-plugin-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2010/07/14/how-to-add-your-own-translation-link-to-language-switcher-by-using-wpml-plugin-of-wordpress/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 13:54:28 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[language switcher]]></category>
		<category><![CDATA[penukar bahasa]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tautan]]></category>
		<category><![CDATA[WPML]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1235</guid>
		<description><![CDATA[WPML is a plugin which has the ability to turn your WordPress site into complete multilingual content management systems. Unfortunately, until now I meant, at least until the time before I found this following solution, WPML only supports for the translation of the WordPress original content, such as: posts, pages, categories, tags, and menus (since [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wpml.org" title="WordPress Multi Lingual" target="_blank">WPML</a> is a plugin which has the ability to turn your WordPress site into complete multilingual content management systems. Unfortunately, until now I meant, at least until the time before I found this following solution, WPML only supports for the translation of the WordPress original content, such as: posts, pages, categories, tags, and menus (since WordPress version 3.0). I can understand about this, since there are so many possibilities about the content you may have in Pods CMS! That is why WPML has not supported for <a href="http://podscms.org" title="Pods CMS">Pods CMS</a> plugin, yet, whereas this feature I have been looking for that could be implemented in WPML too. I have been waiting for such long time, and&#8230; today&#8230; God bless the day I found this following solution, indeed! Although the following modification I made sounds like a little tricky or hackish into the WPML&#8217;s code, but it works very fine at mine. So, if you are using Pods CMS and WPML for your WordPress site, and you want to add your own translation link that came from your own content in Pods CMS into the language switcher that belongs to WPML, then you came to the right place, because this modification is only for you! <span id="more-1235"></span></p>
<p>Another information that you need to know is my site uses two languages: English and Indonesian (default language = Indonesian). </p>
<p>So, this is what I did on my WPML 1.8.0:</p>
<ol>
<li>
Open <strong>/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php</strong> file, and I find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>3399
3400
3401
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span>is_search<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>                    
                    <span style="color: #000088;">$url_glue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">language_url</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'code'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'?'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">===</span><span style="color: #009900; font-weight: bold;">false</span> ? <span style="color: #0000ff;">'?'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'&amp;'</span><span style="color: #339933;">;</span>
                    <span style="color: #000088;">$lang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'translated_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">language_url</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'code'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$url_glue</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'s='</span> <span style="color: #339933;">.</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'s'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>then after the last line of that code, I added this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>3403
3404
3405
3406
3407
3408
3409
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span>is_pod_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Modified by Masino Sinaga, July 14, 2010</span>
		  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$slug_en</span><span style="color: #339933;">,</span> <span style="color: #000088;">$slug_id</span><span style="color: #339933;">;</span>
		  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'code'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'en'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		      <span style="color: #000088;">$lang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'translated_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$slug_en</span><span style="color: #339933;">;</span>
		  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		      <span style="color: #000088;">$lang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'translated_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$slug_id</span><span style="color: #339933;">;</span>
                  <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// Modified by Masino Sinaga, July 14, 2010</span></pre></td></tr></table></div>

</li>
<li>
Open <strong>functions.php</strong> file that located in my theme that I currently using, and then I added this following code at the top/declaration section of the file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$slug_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$slug_en</span><span style="color: #339933;">;</span></pre></div></div>

<p>those variables important in order to tell WPML that in my Pods template, I use them to get the link from my Pods&#8217; content.
</li>
<li>
In my Pods&#8217; template that I created inside my theme directory, I added this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$slug_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$slug_en</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$slug_id</span> <span style="color: #339933;">=</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/propinsi/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$Record</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'slug_id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$slug_en</span> <span style="color: #339933;">=</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/en/province/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$Record</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_field</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'slug_en'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is only one of the examples how I assign those two variables that mentioned above, so this Pods&#8217; template will hold the values, and then the functions.php file will act as the <strong>bridge</strong> between Pods and WPML. In other words, the value of variables will be known by WPML that derived from the Pods.
</li>
</ol>
<p>You can see the demo from this following link:<br />
<a href="http://www.wilayahindonesia.com/propinsi/kode-wilayah-propinsi-nanggroe-aceh-darussalam" title="Region Code of Nanggroe Aceh Darussalam Province" target="_blank">One of the Indonesia Regions</a>. As you can see now, the language switcher (at the right sidebar, also at the bottom of the site) automatically adds the links that came from Pods CMS, either for English or Indonesian. </p>
<p>You will see that those links suddenly just like the links that came from Posts or Pages in WordPress, but they are not. They came from my Pods content, everyone! </p>
<p>Isn&#8217;t that great? Oh, how much I love this! <img src='http://www.openscriptsolution.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2010%2F07%2F14%2Fhow-to-add-your-own-translation-link-to-language-switcher-by-using-wpml-plugin-of-wordpress%2F&amp;title=How%20to%20Add%20Your%20Own%20Translation%20Link%20to%20Language%20Switcher%20by%20Using%20WPML%20Plugin%20of%20WordPress" id="wpa2a_6"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2010/07/14/how-to-add-your-own-translation-link-to-language-switcher-by-using-wpml-plugin-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Replicate the Footer Language Switcher Menu In Order to Display It Also at The Very Top of Site by Using WPML Plugin of WordPress</title>
		<link>http://www.openscriptsolution.com/2010/07/11/how-to-replicate-the-footer-language-switcher-menu-in-order-to-display-it-also-at-the-very-top-of-site-by-using-wpml-plugin-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2010/07/11/how-to-replicate-the-footer-language-switcher-menu-in-order-to-display-it-also-at-the-very-top-of-site-by-using-wpml-plugin-of-wordpress/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 17:59:09 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[custom language switcher]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[WPML]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1227</guid>
		<description><![CDATA[I saw one of the interesting discussion topic on the WPML Forum about the same thing with the title of this article. By accidentally, I have just modified the custom footer language switcher for one of my websites that using multilingual feature, and also wrote the similar article about it a few days ago on [...]]]></description>
			<content:encoded><![CDATA[<p>I saw one of the interesting discussion topic on the <a href="http://forum.wpml.org/topic.php?id=1681" target="_blank" title="replicate footer language switcher menu in header">WPML Forum</a> about the same thing with the title of this article. By accidentally, I have just modified the custom footer language switcher for one of my websites that using multilingual feature, and also wrote the similar article about it a few days ago on this my blog. Thanks for the topic on the forum, so I can do some exploration in order to implement the solution for the question that has been asked on the forum. So here is the solution I made for it. <span id="more-1227"></span></p>
<ol>
<li>
Open your <strong>functions.php</strong> file that usually located inside you theme&#8217;s root directory, and then add this function code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// In order to display language selector of WPML plugin in footer/header of theme</span>
<span style="color: #000000; font-weight: bold;">function</span> languages_list_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$languages</span> <span style="color: #339933;">=</span> icl_get_languages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'skip_missing=0&amp;orderby=code'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'icl_lso_native_lang'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$lang_native_hidden</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$lang_native_hidden</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'icl_lso_display_lang'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$lang_translated_hidden</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$lang_translated_hidden</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>    
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$languages</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div id=&quot;lang_sel_footer&quot;&gt;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// &lt;-- adjust this &quot;lang_sel_footer&quot; with the style that exists in language-selector.css file that belongs to WPML plugin (based on the version you are currently using).</span>
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$languages</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'country_flag_url'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' &lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'country_flag_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;12&quot; alt=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'language_code'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; width=&quot;18&quot; /&gt; '</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt; '</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' &lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">echo</span> icl_disp_language<span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'native_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'translated_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$lang_native_hidden</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt; '</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Since I used WPML version 1.8.0, then I use <strong>lang_sel_footer</strong> style that exists in <strong>sitepress-multilingual-cms/res/css/language-selector.css</strong> file. Please adjust with the style that exists in the related .css file of your WPML.
</li>
<li>
Open your <strong>header.php</strong> file that usually located inside your theme&#8217;s root directory, and add this following code below the .css call:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WP_PLUGIN_URL<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/sitepress-multilingual-cms/res/css/language-selector.css&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> languages_list_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>For example, if you use the <strong>TwentyTen</strong> theme, then you can put that code above after this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;all&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'stylesheet_url'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;</pre></div></div>

</li>
<li>
Now refresh or reload your site, then you should see now at the very top of your page, that custom footer language switcher appears as we want. If the style does not look good at yours, then the problem is usually caused by the style of the language switcher. Please read and follow the first step above carefully.
</li>
</ol>
<p>Have a nice code everyone, and hopefully this will be helpful! <img src='http://www.openscriptsolution.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2010%2F07%2F11%2Fhow-to-replicate-the-footer-language-switcher-menu-in-order-to-display-it-also-at-the-very-top-of-site-by-using-wpml-plugin-of-wordpress%2F&amp;title=How%20to%20Replicate%20the%20Footer%20Language%20Switcher%20Menu%20In%20Order%20to%20Display%20It%20Also%20at%20The%20Very%20Top%20of%20Site%20by%20Using%20WPML%20Plugin%20of%20WordPress" id="wpa2a_8"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2010/07/11/how-to-replicate-the-footer-language-switcher-menu-in-order-to-display-it-also-at-the-very-top-of-site-by-using-wpml-plugin-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to Add Custom Language Switcher Using WPML Plugin of WordPress</title>
		<link>http://www.openscriptsolution.com/2010/06/25/how-to-add-custom-language-switcher-using-wpml-plugin-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2010/06/25/how-to-add-custom-language-switcher-using-wpml-plugin-of-wordpress/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 16:59:34 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[languages_list_footer]]></category>
		<category><![CDATA[multilanguage]]></category>
		<category><![CDATA[WPML]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1207</guid>
		<description><![CDATA[I have just modified the custom language switcher for one of my websites that uses multi language feature by using WPML plugin and Atahualpa theme. I saw the related code to implement it via this following article: Custom Language Switcher. Unfortunately, since WPML has upgraded its version for several times, the &#8220;languages_list_footer()&#8221; function in that [...]]]></description>
			<content:encoded><![CDATA[<p>I have just modified the custom language switcher for one of my websites that uses multi language feature by using <a href="http://wpml.org" target="_blank" title="WPML">WPML</a> plugin and <a href="http://wordpress.bytesforall.com/" target="_blank" title="Atahualpa">Atahualpa</a> theme. I saw the related code to implement it via this following article: <a href="http://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/" target="_blank" title="Custom Language Switcher">Custom Language Switcher</a>. Unfortunately, since WPML has upgraded its version for several times, the &#8220;languages_list_footer()&#8221; function in that article should be changed in order to compatible with the last version of WPML, including the &#8220;lang_native_hidden&#8221; and &#8220;lang_translated_hidden&#8221; parameter that will be used in the &#8220;icl_disp_language&#8221; function. So here is the modification code that I have created in order to display it in the footer of my theme. <span id="more-1207"></span></p>
<ol>
<li>
Put this following code to your <strong>functions.php</strong> file of your current theme:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// In order to display language selector of WPML plugin in footer of theme</span>
<span style="color: #000000; font-weight: bold;">function</span> languages_list_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$languages</span> <span style="color: #339933;">=</span> icl_get_languages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'skip_missing=0&amp;orderby=code'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'icl_lso_native_lang'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$lang_native_hidden</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$lang_native_hidden</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'icl_lso_display_lang'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$lang_translated_hidden</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$lang_translated_hidden</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>    
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$languages</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div id=&quot;footer_language_list&quot;&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$languages</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'country_flag_url'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' &lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'country_flag_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;12&quot; alt=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'language_code'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; width=&quot;18&quot; /&gt; '</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt; '</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' &lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">echo</span> icl_disp_language<span style="color: #009900;">&#40;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'native_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'translated_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$lang_native_hidden</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt; '</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
<li>
Open your <strong>header.php</strong> file of your current theme, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span> <span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/functions/bfa_meta_tags.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>before the first line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WP_PLUGIN_URL<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/sitepress-multilingual-cms/res/css/language-selector.css&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;</pre></div></div>

<p>this is important, in order to include the .css file belongs to WPML plugin.
</li>
<li>
The next step, you have to call that function in your sidebar or any bar of your current theme. For example, I use Atahualpa theme, then I put this code calling in the &#8220;footer.php&#8221; file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> languages_list_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>after this following line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

</li>
<li>
If you want to see the output or demo of this modification, you may visit this following site: <a href="http://www.wilayahindonesia.com" target="_blank" title="Wilayah Indonesia">Wilayah Indonesia</a>, then please scroll your mouse to the bottom of the page (footer), you will see there are two languages, English and Indonesia.
</li>
<li>
Another similar modification with that above, I also have created the custom language switcher in the sidebar of my theme. I put this following code in &#8220;footer.php&#8221; of my current theme:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> do_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;icl_language_selector&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> // call the language selector</pre></div></div>

<p>after this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span> Right Sidebar <span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;</span>td id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;right&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

</li>
</ol>
<p>In order to display the output of the language switcher properly using the original css of WPML, then we have to put that css calling above. And don&#8217;t forget to always include the .css file that belongs to WPML plugin inside your header.php file in order to display the language selector properly.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2010%2F06%2F25%2Fhow-to-add-custom-language-switcher-using-wpml-plugin-of-wordpress%2F&amp;title=How%20to%20Add%20Custom%20Language%20Switcher%20Using%20WPML%20Plugin%20of%20WordPress" id="wpa2a_10"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2010/06/25/how-to-add-custom-language-switcher-using-wpml-plugin-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Get Current Language Code by Using WPML Plugin of WordPress</title>
		<link>http://www.openscriptsolution.com/2010/01/11/how-to-get-current-language-code-by-using-wpml-plugin-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2010/01/11/how-to-get-current-language-code-by-using-wpml-plugin-of-wordpress/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 03:39:09 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[current]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[multi-language]]></category>
		<category><![CDATA[multi-lingual]]></category>
		<category><![CDATA[multilanguage]]></category>
		<category><![CDATA[multilingual]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WPML]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1088</guid>
		<description><![CDATA[I have been using WPML Plugin for one of my multi language websites. Once upon a time, I needed to check the current language code in order to execute my own code that I wrote in the sidebar related to the current language. The question is: How did I get that current language code? After [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using <a href="http://wpml.org" target="_blank">WPML Plugin</a> for one of my multi language websites. Once upon a time, I needed to check the current language code in order to execute my own code that I wrote in the sidebar related to the current language. The question is: How did I get that current language code? After do some searching through the author&#8217;s website, then I found the answer from this following post: <a href="http://wpml.org/documentation/support/wpml-coding-api/">WPML coding API</a>. WPML has provided the constants in order to get: 1) The current language code, 2) The name of current language in the original (current) language, and 3) The name of the current language name in English. Thanks to WPML for providing this constants! <span id="more-1088"></span></p>
<p>If you wan to get the value of those three constants, then you can put this code to your <strong>index.php</strong> file of your current theme.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;Language Code: &quot;</span><span style="color: #339933;">.</span>ICL_LANGUAGE_CODE<span style="color: #339933;">;</span> 
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;Original Language Name: &quot;</span><span style="color: #339933;">.</span>ICL_LANGUAGE_NAME<span style="color: #339933;">;</span> 
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;Language Name in English: &quot;</span><span style="color: #339933;">.</span>ICL_LANGUAGE_NAME_EN<span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Suppose you are using English (en) and Indonesian (id) language, and you want to check the current language code only, so you can execute the certain code related to the current language code, then you can use this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>ICL_LANGUAGE_CODE <span style="color: #339933;">==</span> <span style="color: #0000ff;">'en'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// put your code here if the current language code is 'en' (English)</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>ICL_LANGUAGE_CODE <span style="color: #339933;">==</span> <span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// put your code here if the current language code is 'id' (Indonesian)</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Hopefully this will be helpful.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2010%2F01%2F11%2Fhow-to-get-current-language-code-by-using-wpml-plugin-of-wordpress%2F&amp;title=How%20to%20Get%20Current%20Language%20Code%20by%20Using%20WPML%20Plugin%20of%20WordPress" id="wpa2a_12"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2010/01/11/how-to-get-current-language-code-by-using-wpml-plugin-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Comparing Translation Plugin: qTranslate vs WPML</title>
		<link>http://www.openscriptsolution.com/2009/08/30/comparing-translation-plugin-qtranslate-vs-wpml/</link>
		<comments>http://www.openscriptsolution.com/2009/08/30/comparing-translation-plugin-qtranslate-vs-wpml/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 14:13:32 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[comparing]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[qTranslate]]></category>
		<category><![CDATA[translation]]></category>
		<category><![CDATA[WPML]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=165</guid>
		<description><![CDATA[Another WordPress plugin that has functionality for translating the content of your website besides qTranslate is WPML.  qTranslate stores all languages alternatives for each post in the same post, whereas WPML manages multilingual posts in one post per language. Translations in WPML are then linked together, indicating that one page is the translation of another.  [...]]]></description>
			<content:encoded><![CDATA[<p>Another WordPress plugin that has functionality for translating the content of your website besides <a href="http://wordpress.org/extend/plugins/qtranslate/" target="_blank">qTranslate</a> is <a href="http://wordpress.org/extend/plugins/sitepress-multilingual-cms/" target="_blank">WPML</a>.  qTranslate stores all languages alternatives for each post in the same post, whereas WPML manages multilingual posts in one post per language. Translations in WPML are then linked together, indicating that one page is the translation of another.  Each of this plugin has advantages and disadvantages. <span id="more-165"></span></p>
<p>Here is the comparison between <strong>qTranslate</strong> and <strong>WPML</strong>:</p>
<p>Advantages of WPML:</p>
<ol>
<li>The database contents for posts remain unmodified (easy install and uninstall).</li>
<li>Everything gets translated by default. If a post includes custom fields, they&#8217;re attached to that post, so they are already associated with the language.</li>
<li>Other plugins that analyze contents (like related posts) keep working correctly.</li>
</ol>
<p>Disadvantages of WPML:</p>
<ol>
<li>More complex architecture. The plugin needs to hook to many WordPress functions and filter them so that only contents that matches the language is returned.</li>
<li>Additional tables are required &#8211; normally, to hold the translation grouping.</li>
</ol>
<p>Advantage of qTranslate:</p>
<ol>
<li>Side by side editing is easily implemented.</li>
<li>Less things to break. There are no additional tables and much fewer things to modify in WordPress.</li>
</ol>
<p>Disadvantages of qTranslate:</p>
<ol>
<li>In order to create multilingual contents, the user needs to insert the language tags manually, to everything the plugin doesn&#8217;t hook to. Example: <a href="http://www.openscriptsolution.com/2009/08/22/adjust-microkid-related-posts-with-qtranslate-plugins/" target="_blank">Adjust MicroKid Related Posts with qTranslate Plugins</a></li>
<li>Uninstall can be complicated, as the database needs to be cleaned from multilingual contents.</li>
</ol>
<p>Choosing the most suitable multilingual Plugin for your needs will take some time.</p>
<p>In any case, installing a multilingual plugin is a big change for any site. It would be a good idea to first create a test site and verify that everything works correctly between all the required plugins and the theme and only then install.</p>
<p>Since any multilingual plugin changes the database significantly, doing a database backup is required before experimenting. Have a nice test!</p>
<p>Credits: <a href="http://codex.wordpress.org/Multilingual_WordPress" target="_blank"><strong>Multilingual WordPress</strong></a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F08%2F30%2Fcomparing-translation-plugin-qtranslate-vs-wpml%2F&amp;title=Comparing%20Translation%20Plugin%3A%20qTranslate%20vs%20WPML" id="wpa2a_14"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/08/30/comparing-translation-plugin-qtranslate-vs-wpml/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
