<?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>Drumhead Trap &#187; wpml</title>
	<atom:link href="http://www.adriansilva.org/tag/wpml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adriansilva.org</link>
	<description>Skins and patches</description>
	<lastBuildDate>Wed, 21 Apr 2010 07:16:05 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Arthemia-Premium theme with Wpml</title>
		<link>http://www.adriansilva.org/2009/10/20/arthemia-premium-wpml/</link>
		<comments>http://www.adriansilva.org/2009/10/20/arthemia-premium-wpml/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 09:49:23 +0000</pubDate>
		<dc:creator>skiold</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[customization]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[multilingual]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wpml]]></category>

		<guid isPermaLink="false">http://www.adriansilva.org/?p=429</guid>
		<description><![CDATA[If you run a multilingual wordpress site with wmpl you&#8217;ll probably need to customize your theme files.
Adapting the basic Arthemia theme is covered on an article on wpml.org. Here you can find instructions to make Arthemia-Premium work with WPML.
If this helped you can always
If this helped, but not enough, you can try hiring me for [...]]]></description>
			<content:encoded><![CDATA[<p>If you run a multilingual wordpress site with wmpl you&#8217;ll probably need to customize your theme files.</p>
<p>Adapting the basic Arthemia theme is covered on an article on wpml.org. Here you can find instructions to make Arthemia-Premium work with WPML.</p>
<p>If this helped you can always <form class='donate' method='post' action='https://www.paypal.com/cgi-bin/webscr'>		<input type='hidden' value='5.00' name='amount'/>		<input type='hidden' value='_xclick' name='cmd'/>		<input type='hidden' value='adrian@ageda.net' name='business'/>		<input type='hidden' value='Donate for me' name='item_name'/>		<input type='hidden' value='1' name='no_shipping'/>		<input type='hidden' value='http://www.adriansilva.org' name='return'/>		<input type='hidden' value='http://www.adriansilva.org' name='cancel_return'/>		<input type='hidden' value='EUR' name='currency_code'/>		<input type='hidden' value='' name='page_style'/>		<input type='hidden' value='0' name='tax'/>		<input type='image' alt='PayPal - The safer, easier way to pay online' name='submit' style='border: 0pt none ;' src='https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif'/></form></p>
<p>If this helped, but not enough, you can try <a title="Ageda Infrastructures Contact Form" href="http://www.ageda.net/contacto.html">hiring me for help</a>.</p>
<p>This post is based on the Arthemia customizations used in the <a title="Vino Valencia: Monthly wine events in valencia" href="http://www.vino-valencia.com/">Vino Valencia</a> site.</p>
<h2>Home Page Link</h2>
<p>Relative links and links to the home page  should be fixed as per the <a title="Home Page Links And icl_get_home_url" href="http://wpml.org/home/getting-started-guide/home-page-link/">wpml site recommendations.</a></p>
<p>This is a Search&amp;Replace operation. In any of the theme&#8217;s files we need to replace occurences of:</p>
<ul>
<li>either `<em>get_option(&#8217;home&#8217;)</em>` or `<em>get_settings(&#8217;home&#8217;)</em>`</li>
<li>with `<em>icl_get_home_url()</em>`</li>
</ul>
<h2>Category links</h2>
<p>The function `<em>get_category_link()</em>` is replaced and extended in wpml with `<em>icl_link_to_element()</em>`; this function prints not only the link but also the wrapping html.</p>
<p>Here&#8217;s a sample patch from footer.php showing how we must make the `<em>get_category_link</em>` substitutions</p>
<p>(`-` denotes original line, `+` denotes updated line)</p>
<pre class="brush: diff; light: true;">
-       &lt;h3 class=&quot;cat_title&quot;&gt;&lt;a href=&quot;&lt;?php echo get_category_link($ar_video);?&gt;&quot;&gt;&lt;?php _e('Latest Video Post','arthemia');?&gt;&lt;/a&gt;&lt;/h3&gt;

+       &lt;h3 class=&quot;cat_title&quot;&gt;&lt;?php icl_link_to_element($ar_video, 'category'); ?&gt;&lt;/h3&gt;
</pre>
<p>`<em>icl_link_to_element</em>` uses the name of the category as title (i.e. instead of the original &#8216;Latest Video Post&#8217;). To customize the title use an additional parameter:</p>
<pre class="brush: php; light: true;">

icl_link_to_element($ar_video, 'category', __('Latest Video Post','arthemia'))
</pre>
<p><strong>Category listings</strong></p>
<p>A few componentes of Arthemia Premium use a foreach loop over an array of categories. To get the translated categories instead of the categories of the default language we need to add some wpml magic.</p>
<p>Here&#8217;s a sample substitution from the category bar in header.php :</p>
<p>(using the same patch notation as before)</p>
<pre class="brush: diff; light: true;">

sort($postcat);

foreach ($postcat as $cp_pC ) { ?&gt;

-

-    &lt;?php query_posts(&quot;showposts=1&amp;cat=$cp_pC&quot;); ?&gt;

+

+    &lt;?php $cp_pC = icl_object_id($cp_pC, 'category');

+     query_posts(&quot;showposts=1&amp;cat=$cp_pC&quot;); ?&gt;

&lt;div id=&quot;cat-&lt;?php echo $cp_pC; ?&gt;&quot; class=&quot;category&quot; onclick=&quot;window.location.href='&lt;?php echo get_category_link($cp_pC);?&gt;';&quot;&gt;
</pre>
<p>We tell WPML to get the Id of the translated category before moving on with the `<em>query_posts()`</em> call.  Places that need this fix applied can be found searching for occurrences of `<em>foreach ($postcat as $cp_pC )</em>`. The category bar and the spoilers are two of such places (in header.php and sidebar.php respectively).</p>
<h2>Random posts</h2>
<p>Random posts are selected in arthemia using a customized sql query. We must  join that query with wpml tables to limit the selected post to the current language. These changes serve as templates  for any other custom sql query a custom Arthemia-Premium may have implemented.  Here is the patch for this change (taken from the `<em>filter_queries</em>` function in the sitepress class):</p>
<pre class="brush: diff; light: true;">
-    &lt;?php $randompost = $wpdb-&gt;get_results(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY RAND() LIMIT 12&quot;);

+    &lt;?php $randompost = $wpdb-&gt;get_results(&quot;SELECT ID FROM $wpdb-&gt;posts p

+            JOIN &quot;.$wpdb-&gt;prefix.&quot;icl_translations t ON p.ID = t.element_id

+            WHERE p.post_status = 'publish' AND p.post_type = 'post' AND t.language_code='&quot;.ICL_LANGUAGE_CODE.&quot;'

+            LIMIT 12&quot;);

+

+    shuffle($randompost);
</pre>
<p>We `<em>shuffle()</em>` the posts array instead of including `<em>ORDER BY RAND()</em>` in the query.</p>
<h2>Colors on the category bar</h2>
<p>A tricky change. It can get confusing as the colors are only linked to the category ids in the default language; so you must translate some of the category id and let others unchanged.</p>
<p>I advise to replace the full `<em>for</em>` loop in header.php with the updated one  here:</p>
<pre class="brush: php; light: true;">

for( $cp_i = 1; $cp_i &lt;= $cp_max; $cp_i ++ ) {

$cp_catCol = get_settings( &quot;cp_catColor&quot; );

$cp_iCol = get_settings( &quot;cp_hexColor_&quot; . $cp_i );

$cp_tCol = get_settings( &quot;cp_textColor_&quot; . $cp_i );

$cp_hCol = get_settings( &quot;cp_hoverColor_&quot; . $cp_i );

if( ($cp_iCol != &quot;&quot;) || ($cp_tCol != &quot;&quot;)  ) { ?&gt;

/* category bar */

#cat-&lt;?php echo icl_object_id(get_settings( &quot;cp_colorCategory_&quot; . $cp_i ),'category'); ?&gt; { border-top:8px solid &lt;?php echo $cp_iCol ?&gt;; color:&lt;?php echo

$cp_tCol ?&gt;; }

#cat-&lt;?php echo icl_object_id(get_settings( &quot;cp_colorCategory_&quot; . $cp_i ),'category'); ?&gt;:hover { background:&lt;?php echo $cp_iCol ?&gt;; color:&lt;?php echo $cp

_hCol ?&gt;; }

/* sidebar */

#sidebar h3.catt-&lt;?php echo icl_object_id(get_settings( &quot;cp_colorCategory_&quot; . $cp_i ),'category'); ?&gt;  {background:&lt;?php echo $cp_iCol ?&gt;; color:&lt;?php ec

ho $cp_catCol ?&gt;; }

#sidebar h3.catt-&lt;?php echo icl_object_id(get_settings( &quot;cp_colorCategory_&quot; . $cp_i ),'category'); ?&gt; a { color:&lt;?php echo $cp_catCol ?&gt;; }

&lt;?php } } ?&gt;
</pre>
<p>Note how `<em>icl_object_id</em>` is used only to complete the css class `<em>catt-</em>`.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adriansilva.org/2009/10/20/arthemia-premium-wpml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
