WPML – bbird.me http://bbird.me WordPress quick tips Wed, 08 Aug 2018 16:39:07 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.8 How to translate theme strings using Polylang http://bbird.me/translate-theme-strings-using-polylang/ http://bbird.me/translate-theme-strings-using-polylang/#respond Thu, 08 Sep 2016 21:13:31 +0000 http://bbird.me/?p=544 One of the powerful (or let’s say useful) functions that ship with WMPL is ICL_LANGUAGE_CODE, allowing you to translate strings using PHP

Post How to translate theme strings using Polylang je prvi puta viđen na bbird.me.

]]>
One of the powerful (or let’s say useful) functions that ship with WMPL iICL_LANGUAGE_CODE, allowing you to translate strings using PHP conditional check. This is particularly useful for translating widgets and some other theme translations.

But if you’re not inclined to purchase WMPL, but still need this feature, I only found it within Polylang plugin (when talking about free WordPress plugins). The plugin itself comes with very useful and generous function reference where you will also find the following function

pll_current_language($value);

This function returns the current language, making it useful in the following way:

<?php $currentlang = pll_current_language();
if($currentlang=="en"):?>
    <h1>ENGLISH</h1>
<?php elseif($currentlang=="ar"):?>
    <h1>ARABIC</h1>
<?php endif; ?>

This allows you to create your own conditions based on current language code, making Polylang great free alternative to WPML.

Post How to translate theme strings using Polylang je prvi puta viđen na bbird.me.

]]>
http://bbird.me/translate-theme-strings-using-polylang/feed/ 0